[fxruby-users] FXMenuCascade

Mohammad Khan mkhan at lextranet.com
Fri Sep 10 11:24:19 EDT 2004


I couldn't make MDIClient and MDIChild work.

I have:
@mdiclient = FXMDIClient.new(self) in my initialize method:

Later .. I tried to:

def submenu_shipment(parent)
   FXMenuPane.new(self) do | menupane |
      FXMenuCascade.new(parent, "Shipment", nil, menupane)
      FXMenuCommand.new(menupane, "Add Shipment") do |  cmd |
         cmd.connect(SEL_COMMAND) do
            FXMDIChild.new(@mdiclient, "Add Shipment") do | child |
               child.create
            end
         end
      end
   end
end


Problem, child window is not showing up. I know, I am doing wrong
somewhere, but don't know exactly where it is.

Please help.


Mohammad



On Thu, 2004-09-02 at 21:49, Lyle Johnson wrote:
> 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,
> 
> Lyle




More information about the fxruby-users mailing list