Managing menus |
GiD offers you the opportunity to customize the pull-down menus. You can add new menus or to change the existing ones. If you are creating a problem type, these functions should be called from the InitGIDProject or InitGIDPostProcess functions (see TCL/TK EXTENSION ).
![]() |
|
Note: Menus and option menus are identified by their names.
Note: It is not necessary to restore the menus when leaving the problem type, GiD does this automatically.
The Tcl functions are:
Creates a new menu. New menus are inserted between the Calculate and Help menus.
- menu_name_untranslated: text of the new menu (English).
- prepost can have these values:
"PRE" to create the menu only in GiD Preprocess.
"POST" to create the menu only in GiD Postprocess.
"PREPOST" to create the menu in both Pre- and Postprocess.
- pos: optional, index where the new menu will be inserted (by default it is inserted before the 'Help' menu)
- translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings
Deletes a menu.
- menu_name_untranslated: text of the menu to be deleted (English).
- prepost can have these values:
"PRE" to delete the menu only in GiD Preprocess.
"POST" to delete the menu only in GiD Postprocess.
"PREPOST" to delete the menu in both Pre- and Postprocess.
- translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings
Creates a new option for a given menu in a given position (positions start at 0, the word 'end' can be used for the last one).
- menu_name_untranslated: text of the menu into which you wish to insert the new option (English), e.g "Utilities"
- option_name_untranslated: name of the new option (English) you want to insert.
The option name, is a menu sublevels sublevels list, like [list "List" "Points"]
If you wish to insert a separator line in the menu, put "---" as the option_name.
- position: position in the menu where the option is to be inserted. Note that positions start at 0, and separator lines also count.
- prepost: this argument can have the following values:
"PRE" to insert the option into GiD Preprocess menus.
"POST" to insert the option into GiD Postprocess menus.
"PREPOST" to insert the option into both Pre- and Postprocess menus.
- command: is the command called when the menu option is selected.
- acceler: optional, key accelerator, like "Control-s"
- icon: optional, name of a 16x16 pixels icon to show in the menu
- ins_repl: optional, if the argument is:
- replace: (default) the new option replaces the option in the given position
- insert: the new option is inserted before the given position.
- insertafter: the new option is inserted after the given position.
- translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings
Removes an option from a given menu.
- menu_name_untranslated: name of the menu (English) which contains the option you want to remove. e.g "Utilities"
- option_name_untranslated: name of the option (English) you want to remove. The option name, is a menu sublevels list, like [list "List" "Points"]
- prepost: this argument can have the following values:
"PRE" to insert the option into GiD Preprocess menus.
"POST" to insert the option into GiD Postprocess menus.
"PREPOST" to insert the option into both Pre- and Postprocess menus.
- translationfunc: optional, must be _ for GiD strings (default), or = for problemtype strings
Edit an existent option from a given menu
some parameters can be '-default-' to keep the current value for the command, accelerator, etc
Updates changes made on menus. This function must be called when all calls to create, delete or modify menus are made.
EXAMPLE: creating and modifying menus
In this example we create a new menu called "New Menu" and we modify the GiD Help menu:
![]() |
|
The code to make these changes would be:
GiDMenu::Create "New Menu" "PRE" -1 =
GiDMenu::InsertOption "New Menu" [list "Option 1"] 0 PRE "Command_1" "" "" replace =
GiDMenu::InsertOption "New Menu" [list "Option 2"] 1 PRE "Command_2" "" "" replace =
GiDMenu::InsertOption "New Menu" [list "---"] 2 PRE "" "" "" replace =
GiDMenu::InsertOption "New Menu" [list "Option 3"] 3 PRE "Command_3" "" "" replace =
GiDMenu::InsertOption "Help" [list "My Help"] 1 PRE "" "" "" insert _
GiDMenu::InsertOption "Help" [list "My Help" "My help 1"] 0 PRE "Command_help1" "" "" replace _
GiDMenu::InsertOption "Help" [list "My Help" "My help 2"] 1 PRE "Command_help2" "" "" replace _
GiDMenu::RemoveOption "Help" [list "Customization Help"] PRE _
GiDMenu::RemoveOption "Help" [list "What is new"] PRE _
GiDMenu::RemoveOption "Help" [list "FAQ"] PRE _
GiDMenu::UpdateMenus