[fxruby-users] FXMenuCascade

Lyle Johnson lyle at knology.net
Thu Sep 2 21:49:02 EDT 2004

On Sep 2, 2004, at 11:09 AM, Mohammad Khan wrote:

> I am trying to use FXMenuCascade:
> menu_operation  = FXMenuPane.new(self)
> FXMenuTitle.new(menubar, "&Operation", nil, menu_operation)
> menu_shipment       = FXMenuCascade.new(menu_operation, "Shipment")
> cmd_add_shipment    = FXMenuCommand.new(menu_shipment, "Add\t\tadd
> ashipment")
> Where did I make mistake?

I'm not sure what you're trying to do, but the mistake is probably 
related to this line:

	menu_shipment = FXMenuCascade.new(menu_operation, "Shipment")

If your intention was to have the "Add" menu command be one of the 
commands in the "Shipment" sub-menu, you need to first create a menu 
pane to hold the "Add" command:

	shipment_menu_pane = FXMenuPane.new(self)

and add some commands to it:

	FXMenuCommand.new(shipment_menu_pane, "Add Shipment")
	FXMenuCommand.new(shipment_menu_pane, "Remove Shipment")
	FXMenuCommand.new(shipment_menu_pane, "Check Shipment Status")

and finally add the "Shipment" sub-menu to the parent menu pane 
(menu_operation), specifying that the "Shipment" menu cascade item is 
supposed to pop-up the shipment_menu_pane:

	FXMenuCascade.new(menu_operation, "Shipment", nil, shipment_menu_pane)

So in this scenario, you've got an "Operation" pulldown menu on the 
menu bar. One of the items inside that menu is labelled "Shipment", and 
it's a cascading menu. When you pick "Shipment", it pops up a sub-menu 
with the "Add", "Remove", and "Blah" options.

For examples of how to use FXMenuCascade, see the groupbox.rb example 
included with FXRuby.

Hope this helps,


More information about the fxruby-users mailing list