Clipper Tutorial: a Guide to Open Source Clipper(s)/Making Up a User Interface
Text (Console) InterfacesEdit
The easiest way is to use the basic I/O commands.
Next comes the GT (Graphic Terminal) system (rough descriptions at http://harbourlanguage.blogspot.it/2010/04/harbour-gt.html and https://github.com/vszakats/harbour-core/blob/master/doc/gtapi.txt). Let us start with two simple examples.
FUNCTION One ? "Running function One" RETURN PROCEDURE Two ? "Running procedure Two" RETURN PROCEDURE MAIN // Display menu choices. @ 3, 25 PROMPT "First choice" @ 4, 25 PROMPT "Second choice" // Get menu key. MENU TO choice // Perform an action based on your menu choice. DO CASE CASE choice = 0 RETURN CASE choice = 1 DO One CASE choice = 2 DO Two ENDCASE RETURN
Here is an example taken directly from the Harbour documentation:
// display a two line menu with status line at the bottom // let the user select favorite day SET MESSAGE TO 24 CENTER @ 10, 2 PROMPT "Sunday" MESSAGE "This is the 1st item" @ 11, 2 PROMPT "Monday" MESSAGE "Now we're on the 2nd item" MENU TO nChoice DO CASE CASE nChoice == 0 // user press Esc key QUIT CASE nChoice == 1 // user select 1st menu item ? "Guess you don't like Mondays" CASE nChoice == 2 // user select 2nd menu item ? "Just another day for some" ENDCASE
This example introduces the command
SET MESSAGE TO [<nRow> [CENTER]]
- Extablishes a message row for @...PROMPT command
- GTWVW (hb30\examples\gtwvw)
- GTWVG (by Giovanni di Maria) http://www.elektrosoft.it/tutorials/gtwvg/gtwvg.asp
Getting A LibraryEdit
This section focuses on the use of some libraries for producing a Graphical User Interface.
Commercial software is, for instance, Fivewin for Harbour (FWH)
- FiveWin is original a library for Clipper 5 which you ... More info can be found here: https://www.fivetechsoft.com/english/index.php
The latest HwGUI version needs the nightly build of Harbour.
HMG-IDE (by Roberto Lopez)Edit
Download following link at https://sites.google.com/site/hmgweb/
Run the executable file C:\hmg.3.4.0\IDE\IDE.exe
The first example to get started follows.
- Select the menu File | New Project
- and give it a name such as "first"
- change the Form Title with "First Test" using the Object Inspector Properties tab
- select a Button and put it on the form
- change the Button Caption with "Click me for a test!" using the Object Inspector Properties tab
- select the Events tab of the Object Inspector and type in "ClickTest()" in the Value field corresponding to the Action event
- select Modules in the Project Browser window and double click on main.prg
- add the following code
Procedure ClickTest() Main.Button_1.Caption := "Test done" Return
and save the file
- Punch the F5 key, or select the menu Project | Run, or select the Run button on the Control Panel
The program to edit source code is defined under Tools | Preferences. I find myself at ease with SciTE (https://www.scintilla.org/SciTEDownload.html).