Re: Setting color of a cell



On Thu, Jul 05, 2001 at 01:59:47PM -0400, Ser Nam Lim wrote:

But since I can set the cell background via the "Format Cells" feature
given, there shld be a way to do it, aint that right or am i missing
something? Thanks.

There is definitely a way to do it, and the code you proposed should
be pretty close to what you want.  However, you are obviously using
older code, and the interface has changed.  This makes it difficult
for me to tell you definatively that the code should work.

I'd reccomend updating to CVS or 0.67 and double checking that you
understand the interface to style_color_new.  You should also note
that your action is operating directly on the sheet, and is not
undoable.  In general there are 3 conceptual levels for commands to
operate (this is very general).

1) At the Cell level.  This does not respan, redraw, recalculate, or
update the status.  It may _flag_ some of these things as being
necessary (eg col/row size changes) but it does not actually do
them.

2) The Sheet level.  This is where your proposed code operated.  It
calls routines at the Cell level to do the operation and queues
redraws, calcs, and spans for the entire region.  It is not
undoable.

3) The Command level.  This calls routines at the Sheet level and
handles the undo capabilities.

A good way to do what you want would be to look in
workbook-format-toolbar at the callback for the background colour
combo and to clone the call.  It is very simple, and will provide
undo/redo abilities too.

Good Luck




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]