On Apr 25, 2009, at 2:20 PM, eddy wrote:
> However, I''m am still curious as to the best way to use the fox
> message passing framework to send messages in general. As I
> understand it, the connect method is for specifying when receiving a
> message and I found a reference to sending or delegating messages in
> the regular Fox docs, using ->handle which doesn''t work in
ruby land.
When you call connect(), e.g.
widget.connect(SEL_COMMAND) { ... }
what happens is that FXRuby creates an "anonymous" target object who
responds to the SEL_COMMAND message by executing your passed-in code
block. It then makes this newly-created object the target of "widget".
A call to connect() is thus a quick-and-dirty way to provide a message
handler for the message(s) sent by a widget.
If you want to send a message to a widget (or more generally any FOX
object), you should be able to use handle():
receiver.handle(sender, FXSEL(SEL_COMMAND, message_identifier),
message_data)
Here, "receiver" is the object that will receive the message. There
are admittedly a bunch of different combinations of how this could
work, and we probably don''t cover all of those cases in the FXRuby-to-
FOX binding. If you discover that a particular combination of interest
isn''t working, please submit a bug report and (preferably) a patch to
fix it.
Hope this helps,
Lyle