I recommend to use the GiDMenu:: commands
InsertMenuOption and others are the old-style commands (but they continue working by back-compatibility)
----- Original Message -----
From: Shriram
To: gidlist at gatxan.cimne.upc.edu
Sent: Monday, March 08, 2010 9:46 PM
Subject: RE: [GiDlist] Running Menus/Screens in InitGIDProject
Thanks for the reply. I looked at the course link and it was helpful. I wanted clarify another quick thing.
The course and some of the examples (e.g. Ansys problemtype) use the command: InsertMenuOption for changing the menus.
The manual uses the command: GiDMenu::InsertOption for the same purpose.
Both the commands seem to work but have different syntaxes and usages. Which one would you recommend to use in the longer run?
From: gidlist-admin at gatxan.cimne.upc.edu [mailto:gidlist-admin at gatxan.cimne.upc.edu] On Behalf Of Enrique Escolano
Sent: Monday, March 08, 2010 5:09 AM
To: gidlist at gatxan.cimne.upc.edu
Subject: Re: [GiDlist] Running Menus/Screens in InitGIDProject
You must create a ‘toplevel’ Tk widget, and grid inside your label widget
proc CreateMyWindow { }
set w .gid.yourwindow
toplevel $w
label $w.test -text [= “This is test for screen”]
grid $w.test
}
The InitWindow is a procedure defined by us that create a toplevel and do some extra work,
like store its size and state (open or closed) in our ‘gid.ini’ user-preferences file, and reopen again with the last size.
This procedure is defined inside \scripts\tclfileP.tcl
#w: toplevel name
#title: window title (marked to translation)
#geomname: must be prefixWindowGeom, with prefix unique
#InitComm: the command to be called to reopen the window
proc InitWindow { w title geomname {InitComm “”} { class “”} { OnlyPos 0 } {ontop 1} {nodestroy 0} } {
for example, instead to directly use ‘toplevel’ you can do this:
proc CreateMyTest { }
set w .gid.mytoplevel
InitWindow $w [= “My test caption”] MyTestWindowGeom CreateMyTest
label $w.test -text [= “This is test for screen”]
grid $w.test
}
Note: the [= ] is a procedure we use for translation. We have a program (RamTranslator) that scan the code and extracts the marked strings to a database, and at runtime the [= ] procedure provides the string for the current language (if a tranlated database is provided).
I recommend you to have a look to the ‘chapter 8- Tool of mesh edition’ of the course of the GiD 2004 Conference
http://www.gidhome.com/2004/material_courses.html
Enrique
----- Original Message -----
From: Shriram
To: gidlist at gatxan.cimne.upc.edu
Sent: Friday, March 05, 2010 8:42 PM
Subject: [GiDlist] Running Menus/Screens in InitGIDProject
Hi,
I want to do the following: While starting my problemtype, I want to add an option “Define geometry” to the “Data” menu and when clicked on it, the user can input certain geometries.
However, I cannot bring up the screen that I define in the ‘proc InitGIDProject’. For e.g. if I write the following snippet, nothing happens when I load the problemtype:
Proc InitGIDProject {dir} {
label .test -text “This is test for screen”
grid .test
}
But I think the 2 lines of code executed successfully as there are no errors. If I try to load the problemtype the second time, I get an error message which says the parent window already exists.
I looked at the ‘cmas2d’ example and found the use of the command “InitWindow”. So if I rewrite the code as following, then I can see the test screen:
Proc InitGIDProject {dir} {
set w .gid.win_example
InitWindow $w “CMAS2D.TCL - Example tcl file” ExampleCMAS " " " " 1
label $w.test -text “This is test for screen”
grid $w.test
}
I tried searching everywhere for the InitWindow command to learn more but could not find it. I am not able to bring the screen otherwise in the first case. I am relatively new to TCL/TK so I am not sure what’s happening. Can you clarify the above issue?
Thanks a lot!
Shriram
-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20100309/3d622f37/attachment.htm