[fxruby-users] SEL_LEFTBUTTONPRESS cause 'autograb' ???

Lyle Johnson lyle at knology.net
Sat Oct 29 11:11:16 EDT 2005

On Oct 27, 2005, at 6:39 PM, Piet Hadermann wrote:

> If I run this, the SEL_LEFTBUTTONPRESS gets handled, but

Just a follow-up to my previous response, this apparently is not a bug 
but a "feature".

The standard message handler for SEL_LEFTBUTTONPRESS on an FXButton 
widget gives the button's message target the first chance to handle 
that message. If the button's message target *does* handle the message 
(i.e. the message handler returns something other than false), then 
FXButton considers the message handling complete and doesn't do any 
additional processing. This is what's happening in your case, when you 
have a handler like so:

	@button.connect(SEL_LEFTBUTTONPRESS) { puts "pressed" }

The problem is that, for your purposes, you *do* want FXButton to do 
that additional processing after your code has done its handling of 
SEL_LEFTBUTTONPRESS. For that reason, you need to modify your handler 
code so that when it's done, it returns false, e.g.:

	@button.connect(SEL_LEFTBUTTONPRESS) { puts "pressed" ; false }

You'd want to do the same thing in your SEL_LEFTBUTTONRELEASE handler.

Hope this helps,


More information about the fxruby-users mailing list