Simulating a key press in FXRuby

I have some event-handling code I’d like to test (e.g.
widget.connect…) that’s activated upon SEL_KEYRELEASE. I’ve been
trying to google around and figure out how the FXWindow.handle method
works…its purpose is obvious but I can’t find the right combination
of constants to put in a MKUINT call to form the right unsigned int to
send in as the selector Fixnum.

In addition, I noticed that I can’t instantiate an FXEvent. How do I
create an FXEvent object - is there a factory method somewhere that I
should use?

Thanks,
Steve

Steve wrote:

I have some event-handling code I’d like to test (e.g.
widget.connect…) that’s activated upon SEL_KEYRELEASE. I’ve been
trying to google around and figure out how the FXWindow.handle method
works…its purpose is obvious but I can’t find the right combination
of constants to put in a MKUINT call to form the right unsigned int to
send in as the selector Fixnum.

The first argument to MKUINT is the message identifier part (e.g.
ID_xxx) and the second number is the message type (e.g. SEL_KEYRELEASE):

 widget.handle(sender, MKUINT(ID_FOO, SEL_KEYRELEASE), evt)

In addition, I noticed that I can’t instantiate an FXEvent. How do I
create an FXEvent object - is there a factory method somewhere that I
should use?

Ugh, well, no. Under normal circumstances you don’t instantiate FXEvent
objects; the application does, and passes them on down the line. But I
understand why that would be useful for unit testing. I will make a note
to add this for the next release.

The first argument to MKUINT is the message identifier part (e.g.
ID_xxx) and the second number is the message type (e.g. SEL_KEYRELEASE):

 widget.handle(sender, MKUINT(ID_FOO, SEL_KEYRELEASE), evt)

Do you know what the ID is for this? Or more to the point, how I
would go about finding out what ID constant to use?

Regards,
Steve