Hi there,
I would like to remove the “Calculate remote” option from the “Calculate” menu. However the command:
‘GiDMenu::RemoveOption “Calculate” “Calculate remote” PRE’ does not work. How can I remove this option?
Thanks and greetings,
barnacle
Hi there,
I would like to remove the “Calculate remote” option from the “Calculate” menu. However the command:
‘GiDMenu::RemoveOption “Calculate” “Calculate remote” PRE’ does not work. How can I remove this option?
Thanks and greetings,
barnacle
the second argument of the procedure GiDMenu::RemoveOption must be a list of items that fully identify the desired item path in the tree of submenus.
instead of
GiDMenu::RemoveOption "Calculate" "Calculate remote" PRE
must use:
GiDMenu::RemoveOption "Calculate" [list "Calculate remote"] PRE
GiDMenu::UpdateMenus
the bug of your syntax is that it is like you were finding
Calculate->Calculate->remote
Instead of
Calculate->Calculate remote
That worked thank you (especially for the fast reply)!
Threefollowup questions:
Thanks,
barnacle
in case of multiple separators the name is ambiguour, then it is possible to specify an extra index number, starting from 0,
e.g.
GiDMenu::RemoveOption “Calculate”
This is an example of our code that set at runtime the state of the calculate menu.
proc SetCalculateMenuState { } {
set menu_name "Calculate#C#menu"
set i [ GiDMenu::_FindIndex $menu_name PRE]
if { $i == -1 } return
set menuname [ GetMenuName $i]
if { ![info exists ::RunProcInfo] || $::RunProcInfo == "" } {
set color $::GidPriv(Color,DisabledForegroundMenu)
} else {
set color black
}
set option_name [list "Cancel process#C#menu"]
set position [lindex [split [ GiDMenu::_FindOptionIndex $i $option_name PRE] ,] end]
if { $position != -1 } {
ChangeMenuForegroundColor $menuname $position $color
}
if { [PWFIndOutputFilenameCurrent] == "" } {
set color $::GidPriv(Color,DisabledForegroundMenu)
} else {
set color black
}
set option_name [list "View process info#C#menu"]
set position [lindex [split [ GiDMenu::_FindOptionIndex $i $option_name PRE] ,] end]
if { $position != -1 } {
ChangeMenuForegroundColor $menuname $position $color
}
if { [ GiD_Info Project ProblemType] == "UNKNOWN" } {
set color $::GidPriv(Color,DisabledForegroundMenu)
} else {
set color black
}
set option_name [list "Calculate window#C#menu"]
set position [lindex [split [ GiDMenu::_FindOptionIndex $i $option_name PRE] ,] end]
if { $position != -1 } {
ChangeMenuForegroundColor $menuname $position $color
}
if { [lindex [ GiD_Info Mesh] 0] == 0 || [lindex [ GiD_Info Mesh] 0] == 0 } {
set color $::GidPriv(Color,DisabledForegroundMenu)
} else {
set color black
}
set option_name [list "Calculate#C#menu"]
set position [lindex [split [ GiDMenu::_FindOptionIndex $i $option_name PRE] ,] end]
if { $position != -1 } {
ChangeMenuForegroundColor $menuname $position $color
}
set option_name [list "Calculate remote#C#menu"]
set position [lindex [split [ GiDMenu::_FindOptionIndex $i $option_name PRE] ,] end]
if { $position != -1 } {
ChangeMenuForegroundColor $menuname $position $color
}
}
GiDMenu::Create [= "Kratos#C#menu"] PRE -1
GiDMenu::InsertOption [= "Kratos#C#menu"] [list [= "Model properties#C#menu"]] 0 PRE KMProps::StartBaseWindow "" "" replace
GiDMenu::InsertOption [= "Kratos#C#menu"] [list [= "Material database#C#menu"]] 1 PRE {KMProps::StartBaseWindow Materials} "" "" replace
GiDMenu::UpdateMenus
(‘replace’ is the default mode, it is possible to use others like ‘insert’)