Contents | Index | < Browse | Browse >

                       INTRODUCTION & BASICS
                     -------------------------

 A Graphical User Interface (GUI), is the Buttons, Cyclers,
 Sliders,  Menus and all the other gadgets you play with when
 using a program.

 Gui4Cli is a program which enables anyone to write such a GUI
 and  from it, issue CLI or ARexx commands to other programs.

 What you do, is write a script in the Gui4Cli programming
 language, (which is very easy) and just run it!

 How it works : 
 --------------

 Gui4Cli is and Event-Driven language. This means that it reacts
 to various events, such as the clicking of a gadget by the user,
 or a command to close the window etc.

 Events can be Gadgets, Menus, AppMenuItems, User Actions etc.

 A GUI program is a series of such events, defined by the
 programmer, and attached to these events are commands that are
 executed each time the event "happens"

 Gui4Cli relies heavily on the use of Variables.

 Variables are temporary storage places where you can place any
 sentence or sentences (strings). You can think of them as little
 files.

 These Variables are referenced as follows :

     MyVar   - is the name of a variable called MyVar (case sensitive)
     $MyVar  - is the contents of a variable called MyVar

 Example :

 > MyVar = "DPaint"     ; This stores "DPaint" into variable MyVar
 > Say $MyVar

 Gui4Cli will actually execute :

 > Say  DPaint

 We will call this process  Translation  
 (because I don't know what else to call it)

 This translation is done on ALL the arguments of ALL the Event 
 Commands, making Gui4Cli very flexible.

 Using this Translation method, Gui4Cli is able to provide a GUI that 
 will form any CLI or ARexx command and run it.

 For example, a Cycler (that's the gadget which looks like a button 
 with a bent arrow at one end and when you click on it it changes  the
 text displayed on the button), is declared in the following  way:

 xCYCLER  100 12 100 15   "This is a cycler"   CyclerFile
 CSTR  "DPaint"     "DH0:Dpaint/Dpaint"
 CSTR  "PlaySound"  "DH0:Music/Playsound"
 CSTR  "LightWave"  "DH0:MyDir/MyOtherDir/LightWave"

 This declares a CYCLER type gadget (or EVENT), with it's top left 
 corner at position 100,12 (pixels) of your window, 100 pixels long, 
 and 15 pixels high. The title next to the CYCLER will be "This is a 
 cycler", and the name of the Variable that it will put it's 
 value in will be "CyclerFile".

 This CYCLER will have 3 choices : Dpaint, PlaySound and LightWave.
 Every time you click on the CYCLER, the text shown above next to 
 each of the choices will be placed in the Variable "CycleFile".

 So, if you click on the CYCLER several times and at the end the 
 choice displayed is "PlaySound", then the Variable CyclerFile will 
 contain the words "DH0:Music/Playsound".

 Now, say you declare a BUTTON gadget as follows :

 xBUTTON  10 30 100 15  "RUN"
 CLI 'Run >NIL: $CyclerFile'

 This declares a BUTTON at position 10,30, 100 pixels wide and 15 
 pixels high, with the text <RUN> on it.

 Attached to this Gadget, is the Gui4Cli command "CLI", which means 
 run whatever is declared after it as if it were typed at a shell.

 If you hit this button, the command that will actually be performed 
 will be :

      Run >NIL: DH0:Music/Playsound

 Using other gadgets, you can declare other variables, such as the 
 File name you want loaded (with file requesters), the program's Cli
 options (with checkboxes or cyclers), the volume/rate etc (with 
 sliders), and have a command line like :

      Run >NIL: DH0:Music/Playsound MyFile Volume=64 Option1 Option2 etc...

 This, in effect, provides a GUI for Cli based programs.

 This, is the simplest way in which Gui4Cli can be used. There are 
 many other uses it can be put to, as you will see in the Demos.

 In the above example for the BUTTON gadget, we "attached" the 
 command <CLI 'run NIL: $CyclerFile'> to the BUTTON gadget or EVENT.

 There are many such commands which can be attached to all types of
 Events, forming small programs which are executed every time the  the
 user makes the Event happen (i.e. clicks on the gadget, chooses the
 menu, closes the window, deactivates the window... etc).

 These are called "EVENT COMMANDS" and provide control of what you 
 want to achieve (with commands such as if/endif, gosub/return, 
 while/endwhile etc), the ability to perform Cli commands, send  ARexx
 messages, tell other Gui4Cli windows to open or close and more.

 Apart from the EVENTS and their EVENT COMMANDS there are also  GLOBAL
 COMMANDS, which control the size of your window, which screen it
 opens on etc. and GRAPHICS COMMANDS which allow you to draw lines, 
 boxes, circles, color text etc, in order to give your GUI a nicer 
 appearance.

         Simple Example :  Run Gui   Source 

 The best way to learn how to make a GUI yourself, is to look at the
  tutorials  (which are plain ASCII files with Gui4Cli commands in 
 them) and which are commented. Feel free to change them and 
 try them out to see what happens.

 If you make a mistake, Gui4Cli will tell you what line and what type
 the mistake was.

 There is also a DEBUG option that can be used, which shows you what 
 commands Gui4Cli performs every time you click on a Gadget or  choose
 a Menu, making it easier to work out the logic of your  program.