Setting GUI Object ResourcesGUI resources are set in exactly the same way as graphics object resources; with the create command, with the set command, or in an assignment statement. The code shown in A simple example uses only default resource settings. The next example creates a similar GUI hierarchy, but this time sets resources to give the Menu and Button objects more meaningful names and functionality. The example sets resources using both an assignment statement and during object creation. The complete code for this and other GsharpApp examples can be found in the directory $UNIDIR/example/GsharpApp. Example: gui_lesson1.gsa creating a simple GUI
Notice that the window title has been set by setting the title of the root object gsharp_1. Menu and button labels are set with the resource XuNguiLabel. A callback function has been set for the Exit button so that selecting File->Exit causes a callback to the builtin function GuiFileExit and terminates Gsharp. No callback has been associated with button 1 yet, and for this reason it is set insensitive which gives the button a dimmed appearance and makes it inoperable. When executed, this program produces the GUI and graph shown below.
Carry on to Callback Functions |