These exercises were created by Upi Bhalla for the December 1999 modeling course in Bangalore.
If your script is more than a few lines long you should probably use functions in it. You will also need functions if you want to execute even a slightly complicated operation from a button or dialog.
This is illustrated in ex2.g
xgeom : x coordinate of top right
ygeom : y coordinate of top right
wgeom : width
hgeom : height
Each of these fields can be set directly either as pixels, or as percentages.
// This will move the graph to 20 pixels from the top. setfield /form/graph ygeom 20 // This will set the height of the graph to 40% of the parent xform. setfield /form/graph hgeom 40%
You can also set foreground and background colours.
setfield /form/RUN offbg yellow offfg pinkUgh!!
You can even set labels on most graphical widgets
setfield /form/RUN offlabel "Run really fast now"
Note that buttons make a distinction between on and off states, so you have a proliferation of fgs and labels.