[fxruby-users] Beginner question: handling FXColorDialog cancellation
paolo.micossi at mac.com
Wed Aug 15 09:32:55 EDT 2007
As part of my first FXRuby project I'm trying to set up things so
that the color of some graphic elements gets changed by pressing a
The button pops up an FXColorDialog and code is supplied to handle
the change. I test the value returned by FXColorDialog::execute to
detect cancellation and restore the original color, but it does not
seem to work.
Here is the relevant code fragment:
d = FXColorDialog.new(self,'Colore Sinusoide')
d.rgba = @graph.getPlot('Test Curve').color
c = d.rgba
d.connect(SEL_COMMAND) do |sender,sel,ev|
@graph.getPlot('Test Curve').color = ev
@graph.getPlot('Test Curve').color = c
Before the FXColorDialog is executed I initialize it with the current
color of the object, and also save it in variable "c" for later
restore. The dialog shows up with the right initialized color.
The color= setter method of the graphic elements sends update
messages to the relevant targets, so i can see the color being
updated on screen all right while I'm choosing inside the dialog.
On dialog exit the color will stay put at the last color chosen in
the dialog, regardless of pressing 'Accept' or 'Cancel'
Why is it so?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fxruby-users