Right mouse menu causes FXList to keep scrolling

View: New views
3 Messages — Rating Filter:   Alert me  

Right mouse menu causes FXList to keep scrolling

by Ronald Pijnacker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

The user interface of an application of mine has a couple of
FXLists that are filled enough to get a scroll-bar.
I added a right-mouse pop-up menu to these lists as follows:

    @list.connect(SEL_RIGHTBUTTONPRESS) do |sender, sel, data|
        menu = FXMenuPane.new(@list)
        FXMenuCommand.new(menu, "Some entry") do |mc|
            mc.connect(SEL_COMMAND) { do_something }
        end
        menu.create
        menu.popup(nil, data.root_x, data.root_y)
        getApp().runModalWhileShown(menu)
    end

The pop-up menu works without problems, but when I invoke it
the underlying list keeps scrolling, even with no buttons pressed.

Any ideas?

Ronald
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Right mouse menu causes FXList to keep scrolling

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jun 24, 2009, at 2:50 AM, Ronald Pijnacker wrote:

> The user interface of an application of mine has a couple of
> FXLists that are filled enough to get a scroll-bar.
> I added a right-mouse pop-up menu to these lists as follows:

<snip>

> The pop-up menu works without problems, but when I invoke it
> the underlying list keeps scrolling, even with no buttons pressed.

One of the "hidden" features of FXList is that you can click and drag  
with the right mouse button to scroll the list's contents up and down  
(instead of using the scroll bar). I suspect that your override of the  
SEL_RIGHTBUTTONPRESS message is somehow interacting with this feature.  
What happens if you add a call to ungrab() at the end of the event  
handler block, e.g.

        @list.connect(SEL_RIGHTBUTTONPRESS) do |sender, sel, data|
                # ... everything as before ...
                @list.ungrab
        end

Another thing you could try is changing the connect() to match on  
SEL_RIGHTBUTTONRELEASE, although may cause the same problem as  
SEL_RIGHTBUTTONPRESS is.

Hope this helps,

Lyle
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Right mouse menu causes FXList to keep scrolling

by Ronald Pijnacker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
> On Jun 24, 2009, at 2:50 AM, Ronald Pijnacker wrote:
>
>> The user interface of an application of mine has a couple of
>> FXLists that are filled enough to get a scroll-bar.
>> I added a right-mouse pop-up menu to these lists as follows:
>
> <snip>
>
>> The pop-up menu works without problems, but when I invoke it
>> the underlying list keeps scrolling, even with no buttons pressed.
>
> One of the "hidden" features of FXList is that you can click and drag with
> the right mouse button to scroll the list's contents up and down (instead
> of using the scroll bar). I suspect that your override of the
> SEL_RIGHTBUTTONPRESS message is somehow interacting with this feature. What
> happens if you add a call to ungrab() at the end of the event handler
> block, e.g.
>
> @list.connect(SEL_RIGHTBUTTONPRESS) do |sender, sel, data|
> # ... everything as before ...
> @list.ungrab
> end

Great! This works.
Thanks a lot Lyle. This was getting to quite annoying.

Ronald
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users