[GiDlist] How to disable/enable menus in runtime

Dear friends,

I am using GID as graphical pre/pos-processor in the subject of my Doctor Thesys (UFMG-Brazil). So, I have a problem:

I created some menus using TclTk in InitGIDProject procedure, like shown below:
GidAddUserDataOptions “Análise mecânica” “GidOpenProblemData {Analise mecanica}” 6

Depending on any configurations in DataProblem window, I need that menu (created above) has to be disabled (or enabled again) to avoid inconsistent possibilities on modeling. How can I do that?

I tried to use RemoveMenuOption / GidAddUserDataOptions, but I have the feeling it doesn’t work in runtime (i.e. in procedures different of InitGIDProject).

I need an urgent help. Thanks a lot.

José Carlos L. Ribeiro, M. Sc.
Civil Engineer
Doctorate in Structures Engineering
UFMG - Brazil


Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas!
-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20061012/606bc09c/attachment.htm

Hello José Carlos,

This is a sample for GiD 8.x, because I’m using procedures like GiDMenu::*
(this menu procedures are already undocummented. See contents of the file /scripts/dev_kit.tcl of GiD)
Sample use:
test_create_menu
test_set_menu_state MyMenu MyOption disabled
or
test_set_menu_state MyMenu MyOption normal


#create a menu “MyMenu” and add an item “Myoption”
proc test_create_menu { } {
set menu_name MyMenu
set option_name MyOption
GiDMenu::Create $menu_name PRE
GiDMenu::InsertOption $menu_name $option_name 0 PRE [list WarnWin $option_name]
GiDMenu::UpdateMenus
}

#modify the menu state to “disabled” or “normal”
#sample use: test_set_menu_state “My Menu” “My option”
proc test_set_menu_state { menu_name option_name state } {
set i [GiDMenu::_FindIndex $menu_name PRE]
if { $i == -1 } return
set w .gid.menu
set top [winfo toplevel $w]
if { $top != “.gid” } {
set t $top
} else {
set t “”
}
set menuname $t.mm1.button$i
set position [lindex [split [GiDMenu::_FindOptionIndex $i $option_name PRE] ,] end]
if { $position != -1 } {
if { $state == “disabled” } {
ChangeMenuForegroundColor $menuname $position $::GidPriv(Color,DisabledForegroundMenu)
} else {
ChangeMenuForegroundColor $menuname $position “black”
}
$menuname entryconfigure $position -state $state
}
}

Regards

Enrique Escolano
----- Original Message -----
From: José Carlos UFMG/Brazil
To: gidlist at gatxan.cimne.upc.es
Sent: Friday, October 06, 2006 3:28 PM
Subject: [GiDlist] How to disable/enable menus in runtime


Dear friends,

I am using GID as graphical pre/pos-processor in the subject of my Doctor Thesys (UFMG-Brazil). So, I have a problem:

I created some menus using TclTk in InitGIDProject procedure, like shown below:
GidAddUserDataOptions “Análise mecânica” “GidOpenProblemData {Analise mecanica}” 6

Depending on any configurations in DataProblem window, I need that menu (created above) has to be disabled (or enabled again) to avoid inconsistent possibilities on modeling. How can I do that?

I tried to use RemoveMenuOption / GidAddUserDataOptions, but I have the feeling it doesn’t work in runtime (i.e. in procedures different of InitGIDProject).

I need an urgent help. Thanks a lot.

José Carlos L. Ribeiro, M. Sc.
Civil Engineer
Doctorate in Structures Engineering
UFMG - Brazil

\

Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas!
-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20061014/134715da/attachment.htm