1 | Here is the gist of how EXPGUI works. |
---|
2 | |
---|
3 | * read the .exp file into exparray (expload) |
---|
4 | * map the phases & histograms etc with expmap (mapexp) |
---|
5 | |
---|
6 | Here is the tricky part: |
---|
7 | |
---|
8 | * I have a set of routines (----info) that read and write various parameters |
---|
9 | |
---|
10 | * To "map" values from exparray to tcl variables (so that they get updated in the exparray as one edits them), the variables are placed in |
---|
11 | array entryvar and array entrycmd is used to hold the command to set the value. |
---|
12 | * A trace on entryvar is used to execute the appropriate entrycmd code any time a variable is set [in entvartrace] |
---|
13 | |
---|
14 | Example: |
---|
15 | set entryvar(cycles) [expinfo cycles] |
---|
16 | set entrycmd(cycles) "expinfo cycles" |
---|
17 | |
---|
18 | this uses expinfo cycles to get the number of ls cycles |
---|
19 | if entryvar(cycles) is changed (by changing the contents of the |
---|
20 | entry associated with the variable), then in entvartrace the command |
---|
21 | expinfo cycles set $entryvar(cycles) |
---|
22 | is executed to put the value into the exparray and flag that a change |
---|
23 | has been made. |
---|
24 | |
---|
25 | This is why the first step is to write a ----info routine where |
---|
26 | you get the value using ---info var <otherparms> |
---|
27 | and set it using ---info var <otherparms> set value |
---|
28 | |
---|
29 | The next step is to map the various parameters (like P.O. axis) to unique |
---|
30 | array elements in entryvar & entrycmd |
---|
31 | |
---|
32 | And the last step is to create a GUI with various widgets that allow the user to change the appropriate values. In this way, what you change does into the .exp file as soon as you save it. |
---|
33 | |
---|
34 | In some cases, where there is a toplevel with a "Save Changes" & "Cancel Changes" button (e.g. Background, Constraints, changes are done a bit more straightforwardly. |
---|