[fxruby-users] How do you enable a button for any option change in UI?

Paul Carvalho tester.paul at gmail.com
Tue Mar 23 10:12:24 EDT 2010


>
> Almost every widget that can be "clicked" sends a SEL_COMMAND message
> to its target whenever it gets clicked. This is true for basic
> buttons, but also for radio buttons, check buttons, etc. I would have
> assumed that you were already reacting to these messages anyways. But
> anyways, so, it's not exactly that you're iterating through all of the
> options constantly, but you'd just watch for when they change, e.g.
>
>    @option1 = FXCheckButton.new(...)
>    @option1.connect(SEL_COMMAND) do
>      # the user clicked this check button to turn the option "on" or
> "off"...
>      @config_changed = true
>    end
>

Ah, yes.  I hadn't gotten that far yet.  I'm still working with the UI to
see if I can get it to do everything I need before I add the guts of the
functions.  Thanks for the tip here.



>
> >>
> >> That sounds like a good job for the registry (FXRegistry) service.
>
> Sure, take a look at the imageviewer.rb example program that comes
> with FXRuby. In the ImageWindow#onCmdQuit method you see examples of
> how to write application settings out to the registry; in
> ImageWindow#create, you see the opposite (reading those saved settings
> back into the application).
>

That's perfect. Thanks.

I am now debating whether it's worth the bother of having a separate [Save
Config] button or if I should just automatically save the options every time
on exit like that example.

BTW, do you know where these registry options are saved on a Windows box?  I
searched for a .foxrc file and in the registry but I couldn't find them.
I'd like to have an idea of what the saved options look like to help me
figure out how to save/load them.

Thanks!  Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100323/4969a0ca/attachment.html>


More information about the fxruby-users mailing list