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

Piet Hadermann piet.hadermann at pandora.be
Thu Oct 27 19:39:33 EDT 2005


Hello list!

After the initial troubles getting fxruby up and running, I'm really
enjoying both ruby and fxruby.

BTW:Lyle: about half of the times I turned to the web/googlegroups/...
to find solutions to an issue it was answered in a message/post from
you. They should give you a ruby statue or something. Or maybe 2:one for
making fxruby, one for being so much help handling problems/questions.
Thanks!


Most things just work as expected and I've been flabbergasted a few
times seeing how easy it can be to implement even more advanced gui
trickery. The only gui related programming I've been doing the last
couple of years was with the vc++/mfc combo, and ruby/fxruby is really
breath of fresh air that makes you do things instead of wondering how
you should do them.

However, there's something weird bugging me at the moment. I'll use the
'fx_button.rb' example to explain things.

I added the following in ButtonWindow.initialize:

    @button.connect(SEL_LEFTBUTTONPRESS) {
      puts 'lmb pressed'
    }

    @button.connect(SEL_LEFTBUTTONRELEASE) {
      puts 'lmb release'
    }

If I run this, the SEL_LEFTBUTTONPRESS gets handled, but
SEL_LEFTBUTTONRELEASE doesn't. Also, it seems this causes all events to
be automatically 'grabbed' to 'button' and I am not able to click any
other button. I can't even close the window (except when using ALT-F4).
Everytime I press the left mousebutton, no matter where, it gets handled
by that button handler (after pressing the button once).
If I add an 'ungrab' in there, like this:

    @button.connect(SEL_LEFTBUTTONPRESS) {
      puts 'lmb pressed'
      @button.ungrab
    }

I can at least close the window again and pressing other buttons gets
handled again. But, SEL_LEFTBUTTONRELEASE stil doesn't seem to get
handled.

If I just delete handling of SEL_LEFTBUTTONPRESS, then
SEL_LEFTBUTTONRELEASE gets handled when I release left mousebutton.

I get the same behaviour under a WinXP as wel as a Fedore Core 3
installation, both using fxruby 1.4.2.
(ah yes: basically this is a first step in wanting to click that button
and move it around)

Is this a bug or am I seeing/assuming things wrong ?

Thanks in Advance!

Piet.





More information about the fxruby-users mailing list