Inserting Menus into a Bar
- Last UpdatedJan 09, 2024
- 1 minute read
You can insert new fields into a menu bar using the InsertBefore() and InsertAfter() methods, which insert the new fields relative to existing named menus. The methods use named menus to determine the point where they should insert the new menu.
The general syntax is:
InsertBefore(<TargetMenuName>, <Dtext>, <MenuName>)
InsertAfter(<TargetMenuName>, <Dtext>, <MenuName>)
Where the fields have the following meanings:
|
Field |
Description |
|---|---|
|
<TargetMenuName> |
is the name of the menu immediately before or after where you want the new menu to go. |
|
<Dtext> |
is the display-text for the menu. |
|
<FieldName> |
is the unique name for the menu within the bar. |
For example:
setup form !!MyForm Dialog size 30 5
bar
-- adds a pulldown for menu1 labelled with <dtext>
!this.bar.Add( ‘<dtext>’, ‘menu1’ )
-- adds a window pulldown labelled with <dtext>
!this.bar.Add( ‘<dtext>’, ‘Window’ )
-- adds a help pulldown labelled with <dtext>
!bar.InsertAfter( ‘Window’, ‘<dtext>’, ‘Help’ )
...
exit
If you use the identifier ‘Window’ or ‘Help’ as the name of the menu, the system will interpret them as system Window and Help menus, although they will still be displayed with the string given in <dtext>.
Named menus and the methods that create them are discussed in more detail in the rest of this section.