[fxruby-users] Popup menu attached to a FXTreeItem

thom01 thom01 at laposte.net
Wed Aug 17 08:54:56 EDT 2005


Hi Lyle

Thanks a lot, your example helped me to solve my problem.
I'm a little confused with the create function :
> 		# Create it
> 		popupMenu.create

I have a menu bar in my application, I don't have to call
create to display a menu pane from it.
Maybe because the menu bar is part of the main window, and
menus are created before calling FXMainWindow.show or
FXApp.create ?

I think I have the same kind of problem to add a new tab item
to a tabbook.
If you have time, could you complete the tabbook example
(http://www.fxruby.org/examples/tabbook.rb) by adding an
Add/Remove tab menu option ?

Thanks

Thomas Vanier


> On Aug 5, 2005, at 1:08 PM, thom01 wrote:
> 
> > I'd like to display a popup menu after a right click on a tree
> > item, I cannot make it work :
> 
> <snip>
> 
> This is the typical pattern I'd use for a right-click popup
menu on a 
> tree item (or whatever);
> 
> 	treelist.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, evt|
> 		# Construct the menu pane
> 		popupMenu = FXMenuPane.new(parent)
> 
> 		# Add some menu items...
> 		FXMenuCommand.new(popupMenu, "One")
> 		FXMenuCommand.new(popupMenu, "Two")
> 
> 		# Create it
> 		popupMenu.create
> 
> 		# Show it
> 		popupMenu.popup(nil, evt.root_x, evt.root_y)
> 
> 		# Restrict to this window while shown...
> 		app.runModalWhileShown(popupMenu)
> 	end
> 
> I just confirmed that this works in FXRuby 1.2, but I don't
know why it 
> wouldn't also work in FXRuby 1.0.
> 
> Hope this helps,
> 
> Lyle
> 
> 

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)






More information about the fxruby-users mailing list