[fxruby-users] Beginner question: handling FXColorDialog cancellation

Lyle Johnson lyle.johnson at gmail.com
Fri Aug 17 23:07:28 EDT 2007

On Aug 15, 2007, at 8:32 AM, Paolo Micossi wrote:

> 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.

The execute() method returns either 0 or 1, so I think the problem  
has to do with the test that you're using:

	unless d.execute
		# ...

The code inside this block will *never* run, because both 0 and 1  
evaluate to "true" in Ruby. You should see the expected result for  
Cancel if you change it to this:

	if d.execute == 0
		@graph.getPlot('Test Curve').color = c

Hope this helps,


More information about the fxruby-users mailing list