Clipper Tutorial: a Guide to Open Source Clipper(s)/Making Up a User Interface

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Text (Console) Interfaces[edit]

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

GUI Design[edit]

Getting A Library[edit]

This section focuses on the use of some libraries for producing a Graphical User Interface.

Library URL Notes Tutorial/Documentation URL
HbQt https://sourceforge.net/projects/qtcontribs/ see \hb30\contrib\hbqt

(QtContribs includes HbQt, HbIDE & HbDBU)

http://www.elektrosoft.it/tutorials/hbqt/hbqt.asp
HMG https://sites.google.com/site/hmgweb/

http://sourceforge.net/projects/hmg

RAD https://sites.google.com/site/hmgweb/tutorial

http://www.hmgforum.com/hmgdoc/data/index.htm

Harbour MiniGUI Extended Edition http://www.hmgextended.com/

https://hmgextended.org/

RAD http://www.hmgextended.com/files/manual/index.html

http://www.hmgextended.com/files/winreport/index.html

wxHarbour http://sourceforge.net/projects/wxharbour/ bindings for wxWidgets

Last Update: 2016-08-24

ooHG https://oohg.github.io/
Marinas-GUI http://marinas-gui.org/ a wrapper for Harbour with Qt http://www.marinas-tools.com.ar/
HwGUI http://sourceforge.net/projects/hwgui/ Last Update: 2019-06-11 http://www.kresin.ru/en/hwgdoc.html
T-Gtk GUI for [x]Harbour https://sourceforge.net/projects/t-gtk/ Last Update: 2019-06-24
WoopGUI - A Win32 OOP GUI Library for Harbour http://woopgui.sourceforge.net/ Last updated: 2002/05/22
xhgtk https://sourceforge.net/projects/xhgtk/
HBUI https://github.com/RJopek/HBUI
hbgi https://github.com/tuffnatty/hbgi

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

HwGUI[edit]

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).

See http://www.elektrosoft.it/tutorials/hmg/hmg.asp

HMG-IDE (by Walter Formigoni)[edit]

http://hmgs-minigui.sourceforge.net/