Re: XForms: fl_setpup_submenu

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 17 Sep 98 07:52:45 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I have a form in which there is a pull down menu with no entries. This
> was set up using fdesign. I later add entries using fl_addto_menu. I then
> use fl_newpup to create another menu that I want to attach to one of the
> original menu's entries. Where can I get the menuID that is needed in
> fl_setpup_submenu. If I understand the syntax right, I need the menuID
> of the parent menu, the item number of the parent menu, and the submenu
> id (returned from fl_newpup).

You should use fl_newpup() or fl_defpup() to create the top level
menu, rather than fl_addto_menu(). Then use fl_set_menu_popup() to
tie the menu popup to the menu button. For example:

menu_id = fl_defpup( FL_ObjWin( fd_try->menu ), "Foo|Bar|Baz" );
fl_set_menu_popup( fd_try->menu, menu_id );

sub_menu_id = fl_defpup( FL_ObjWin( fd_try->menu ), "Woof|Bag" );
fl_setpup_submenu( menu_id, 2, sub_menu_id );

Thus, menu item "Bar" will have a submenu tied to it.

If you do the submenu create at some point later in your code, you can
get the menuID attached to the menu button by

menu_id = fl_get_menu_popup( fd_try->menu );

I have to admit this is not exactly clear from the manual. The use of
menuID and popupID interchangably is particularly confusing.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/