Tuesday, March 2, 2010

Enabling checkboxes in FXRuby

While playing around with FXRuby, I tried to create a form window where you could have an "Include All?" check box at the top that automatically enables/disables all the other options (check boxes) below.

This turned out to be non-obvious to code for a non-programmer like me. None of the FXRuby examples include code that does something like this. Google didn't help and neither did the FXRuby book. (Although in all fairness, I only skimmed through the book and didn't read the whole thing.)

I posted a request for some help to the FXRuby forum and a kind soul wrote up an example to do just that. Rather than include the sample code in an email, he posted it online at: http://pastebin.com/rPKJLC9r

I'd never heard of Pastebin.com until now. Seems like a cool place to drop random chunks of code that you can have others look over and help you get working. I posted the link here so I can remember where to find it next time.

Oh, and the FXRuby code example was perfect. Just what I needed. The sample code was an over-simplified version of what I needed to do but it was enough to help me understand the relationship between the objects and commands.

No comments:

Post a Comment