[fxruby-users] Contextual menu in FXTreeList

Philippe Lang philippe.lang at attiksystem.ch
Fri Sep 29 02:52:53 EDT 2006


Hi,

I've got code that manages a contextual menu in an FXTreeList:

    tree.connect(SEL_RIGHTBUTTONPRESS) do |sender, selector, data|
        index = tree.getItemAt(data.win_x, data.win_y)
        if index != nil
            tree.killSelection
            tree.selectItem(index)
            filemenu = FXMenuPane.new(self)
            FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", nil, app, FXApp::ID_QUIT)
            filemenu.create()
            filemenu.popup(nil, data.root_x, data.root_y)
            filemenu.grabKeyboard
            getApp().runModalWhileShown(filemenu)
        end
    end


It works just fine, except for one thing: when you right-clic on an item, and the menu appears, you cannot simply right-clic on another item, and expect a menu to appear again. You have to clic twice; the first clic disables the first menu, and the second shows the second menu.

Is there a way to change that? I've tried disabling "runModalWhileShown", but it does not help.

Thanks!

---------------
Philippe Lang
Attik System

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3125 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20060929/6e73e9e7/attachment.bin 


More information about the fxruby-users mailing list