[fxruby-users] Popup menu attached to a FXTreeItem

Lyle Johnson lyle at knology.net
Tue Aug 9 09:32:48 EDT 2005

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 :


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

		# Show it
		popupMenu.popup(nil, evt.root_x, evt.root_y)

		# Restrict to this window while shown...

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,


More information about the fxruby-users mailing list