Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


The problem type developer can change the way a QUESTION is displayed and if he wishes he can also change the whole contents of a window, while maintaining the basic behavior of the data set, i.e. in the Condition window: assign, unassign, draw; in the Material window: create material, delete material; and so on.


With the default layout for the data windows, the questions are placed one after another in one column inside a container frame, the QUESTION's label in column zero and the VALUE in column one. For an example see picture below.


Code Block
CONDITION: Steel_section

...


CONDTYPE: over lines

...


CONDMESHTYPE: over body elements

...


QUESTION: Local_Axes#LA#(-Default-,-Automatic-)

...


VALUE: -Default

...

-
QUESTION: SteelName

...


VALUE: IPN-80

...


QUESTION: SteelType

...


VALUE: A37

...


END CONDITION 


Image Modified


The developer can override this behavior using TKWIDGET. TKWIDGET is defined as an attribute of a QUESTION and the value associated with it must be the name of a Tcl procedure, normally implemented in a Tcl file for the problem type. This procedure will take care of drawing the QUESTION. A TKWIDGET may also draw the entire contents of the window and deal with some events related to the window and its data.


The prototype of a TKWIDGET procedure is as follow:

Code Block
proc TKWidgetProc {event args} {

...


  switch $event {

...


    INIT

...

 {
       ...

...


    }
    SYNC {
       ...
    }
    DEPEND {
       ...
    }
    CLOSE {
       ...
    }
  }
}


Note: It is also allowed to add extra arguments before the 'event' argument, and provide its values in theTKWIDGET field


e.g. declare this tkwidget procedure with a first argument "-width 20"

Code Block
TKWIDGET: GidUtils::TkwidgetEntryConfigure {-width 20}



and then define the Tcl procedure ready to get the first extra argument 'configure_options' before 'events':

Code Block
proc GidUtils::TkwidgetEntryConfigure { configure_options event args } {

...


  ...

...


}


The argument event is the type of event and args is the list of arguments depending on the event type. The possible events are: INIT, SYNC, CLOSE and DEPEND. Below is a description of each event.

  • INIT: this event is triggered when GiD needs to display the corresponding QUESTION and the list of arguments is {frame row-var GDN STRUCT QUESTION}: frame is the container frame where the widget should be placed; row-var is the name of the variable, used by GiD, with the current row in the frame; GDN and STRUCT are the names of internal variables needed to access the values of the data; QUESTION is the QUESTION's name for which the TKWIDGET procedure was invoked. Normally the code for this event should initialize some variables and draw the widget.
  • SYNC: this is triggered when GiD requires a synchronization of the data. Normally it involves updating some of the QUESTIONs of the data set. The argument list is {GDN STRUCT QUESTION}.
  • CLOSE: this is triggered before closing the window, as mentioned this can be canceled if an ERROR is returned from the procedure.
  • DEPEND: this event is triggered when a dependence is executed over the QUESTION for which the TKWIDGET is defined, ie. that QUESTION is an lvalue of the dependence. The list of arguments is {GDN STRUCT QUESTION ACTION value} where GDN, STRUCT and QUESTION are as before, ACTION could be SET, HIDE or RESTORE and value is the value assigned in the dependence.

...


The picture below shows a fragment of the data definition file and the GUI obtained. This sample is taken from the problem type RamSeries/rambshell and in this case the TKWIDGET is used to create the whole contents of the condition windows. For a full implementation, please download the problem type and check it.


Code Block
CONDITION: Steel_section

...


CONDTYPE: over lines

...


CONDMESHTYPE: over body elements

...


QUESTION: Local_Axes#LA#(-Default-,-Automatic-)

...


VALUE: -Default

...

-
QUESTION: SteelName

...


VALUE: -

...


QUESTION: SteelType

...


VALUE: -

...


TKWIDGET: SteelSections

...


END CONDITION 


Image Modified



Predefined TKWIDGET procedures:
There are some useful features that have been implemented in tcl procedures provided by default in GiD, inside the dev_kit.tcl file,
specially to replace the standard entry of a question by some specialized widget.

  • GidUtils::TkwidgetGetFilenameButton

To show an entry and a select file button that open the dialog window to select an existent file.


  • GidUtils::TkwidgetPickPointOrNode

To show an entry and a button to pick in screen the id number of a point in geometry mode or a node in mesh mode


  • GidUtils::TkwidgetGetLayername

...

To show a combobox with the current groups


  • GidUtils::TkwidgetGetVector3D

...