[fxruby-users] defining events in fox 1.2

Jacob Hanson jacdx at jacobhanson.com
Fri May 13 00:28:27 EDT 2005


Thanks to the list I'm back to progressing with my custom control.
Now, what I can't find after an hour of RTFM is how to define events
so that something can .connect to them.

I read how the older, C++ Fox-like .enum/FXMAPFUNC/Responder interface was
replaced with the .connect interface for handling events in your
applications. But when you're building a widget, how do you define those
events?

Say I have a widget that should do nothing else but change the background
color of itself when clicked. The only thing that I can fathom at this point
is that you have to use Responder's .enum to define your desired custom message
IDs (perhaps ID_RED, ID_BLUE for background colors) and then use FXMAPFUNC to map
the message type + message ID combinations to actual methods inside
the widget (e.g. FXMAPFUNC(SEL_COMMAND, ID_RED, :onSetRedBackground))
Is this the correct way to do it with FXRuby 1.2?

Thx.
Jacob



More information about the fxruby-users mailing list