Step 1 - A simple example

We start by making the simplest of examples.

Cut and paste the following lines into a text editor such as TextPad or notepad.

create Menubar gsharp_1.Menubar;
create Menu gsharp_1.Menubar.File;
create Button gsharp_1.Menubar.File.Exit
 ( XuNguiLabel = "Exit ...",
   XuNguiCallback = "GuiFileExit"
 );
create Canvas gsharp_1.Canvas;
exec("$UNIDIR/example/Gsharp/flight.gsl");

Notice that:

  • We have created a number of objects in a hierarchy
  • We have set the label resource of our Exit button. The button will now appear as "Exit ..." rather than the default which is the button name "Exit".
  • We have set the callback for the exit button to be "GuiFileExit" - we will look at this in the next step.

Save the file as myapp.gsa in your working directory.

On UNIX or VMS run your file like this (you may need to set-up your UNIRAS environment first):

GsharpApp myapp.gsa

On Windows you can double click on myapp.gsa. If you are using TextPad and have configured it as recommended you can just press Ctrl-2 to run your script using GsharpApp.

Something like this should then appear:

Notice how each of our GUI objects has appeared and then carry on to Step 2 - Callback Functions