If you read a model pertaining of a problem type, this problem type is also loaded, and the InitGIDProject event is raised
Store inside a global tcl variable a value to call your function only once.
proc InitGIDProject { dir } {
global MyProblemTypeVars
if { ![info exists MyProblemTypeVars(IsTheFisrtType)] || $MyProblemTypeVars(IsTheFisrtTime) == 0 } {
set MyProblemTypeVars(IsTheFisrtTime) 1
MyFunction
}
}
----- Original Message -----
From: Christophe Louis
To: gidlist at gatxan.cimne.upc.es
Sent: Friday, September 20, 2002 3:00 PM
Subject: Re: [GiDlist] InitGIDProject-LoadGIDProject
In fact I would like to create a TCL/TK procedure which would be called once (and only once) when you define the problem type, and which wouldn’t appear every time you open a saved project.
Christophe Louis
----- Original Message -----
From: Enrique Escolano
To: gidlist at gatxan.cimne.upc.es
Sent: Friday, September 20, 2002 2:40 PM
Subject: Re: [GiDlist] InitGIDProject-LoadGIDProject
InitGIDProject is a event generated by loading the problemtype, the argument provided is the
complete path of the directory .gid of this problem type
For example:
InitGIDProject C:/gid project/problemtypes/Test s/Vel Giro.gid
EndGIDProject is a event generated by unloading the problemtype.
LoadGIDProject is generated loading a model (also after load a problem type), the argument is the
complete path name of the file of this model to contain specific problemtype data (.spd extension)
For example:
LoadGIDProject C:/public/model.gid/model.spd
SaveGIDProject is generated if the user (or the automatic backup) save the model, it is an oportunity to the problem data to save some specific data in the spd file.
To test this events, use a WarnWinText command to show a debug message
For example, copy in ‘problemtype’.tcl this code:
proc InitGIDProject { dir } {
WarnWinText “InitGIDProject $dir”
}
proc InitGIDPostProcess {} {
WarnWinText “InitGIDPostProcess”
}
proc EndGIDProject {} {
WarnWinText “EndGIDProject. Falla si había cerrado esta ventana y cargo otro problem type”
}
proc LoadGIDProject { filespd } {
WarnWinText “LoadGIDProject $filespd”
}
proc SaveGIDProject { filespd } {
WarnWinText “SaveGIDProject $filespd”
}
proc LoadResultsGIDPostProcess { file } {
WarnWinText “LoadResultsGIDPostProcess $file”
}
proc EndGIDPostProcess {} {
WarnWinText “EndGIDPostProcess”
}
proc BeforeWriteCalcFileGIDProject { file } {
WarnWinText “BeforeWriteCalcFileGIDProject $file”
}
proc AfterWriteCalcFileGIDProject { file errcode} {
WarnWinText “AfterWriteCalcFileGIDProject $file $errcode”
}
Is it not possible to avoid the call to InitGIDProject, but if you not write a proc InitGIDProject, to make some action in response, this event is ignorated.
Enrique
----- Original Message -----
From: Christophe Louis
To: Gid
Sent: Friday, September 20, 2002 12:37 PM
Subject: [GiDlist] InitGIDProject-LoadGIDProject
Hello,
I would like to know exactly when the InitGIDProject and the LoadGIDProject procedures are called. Indeed, when I call DataProblem Types…, the LoadGIDProject is also called, and when I open a saved file, the InitGIDProject is called. Is it possible to avoid calling the InitGIDProject procedure when the problem type is selected?
Christophe Louis
-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20020925/29ac40e2/attachment.htm