An explanation about HMG …

An explanation about Harbour, HMG and HMG-IDE

By Sri  Rathinagiri » Mon Sep 08, 2014 12:44 pm

Clipper programmers sometimes find it difficult to accommodate with HMG. The reason is the difference between TUI (Text User Interface) and GUI. In GUI, the program control is in the hands of the user and it is event driven. User can click on anything (say minimize button, maximize button, even another program running behind or any controls). So, it is our duty to design the whole window and wait for user’s action and write procedures for each and every action of the user.

GUI offers many innovative controls like Grid, Combobox, Button, Spinner etc., as against only textbox in TUI. So, we have to eventually accommodate events for all these controls.

Now, coming to HMG as not only a GUI library but a bundle of all. Even though HMG is directly based on the latest Harbour versions, HMG comes as a bundle. You need not install any other software to build a windows application. Full stop. 🙂 It contains the GUI library, PRG compiler, C Compiler and all the supporting software products to successfully build an application.

People (at least me) sometimes misunderstand GUI and OOP as one and the same. GUI and OOP are different and independent to each other. GUI can be made to work with or without OOP and vice versa. HMG is based on Win32 API system. Win32 API system works on handles and hooks. Every window/control in HMG is provided with a handle (like the file handle in clipper) and events are hooked on that particular handle. Once any hooked event is fired by the user (say a click of a button) immediately Win32 API searches for a CallBack function which is provided by the developer via HMG. The beauty of HMG would be, the developer is made free from handling all these internal affairs, handles, hooks and callback procedures. Instead he can concentrate on what is to be done if the event is fired.

You will be astonished to see how a ‘define window’ statement in HMG invokes 100s of lines of Harbour and C code. Please see the source folder of HMG if you want to know in detail.

Again, the advantage of HMG is, you need not include any dlls with your executable code as it is based on Win32 API. The application would run in XP to Windows version 8 (even in Windows 97 some cases).

Now coming to your questions.

1) How to get a lot of of source codes containing of samples to handle screen-menus ; from basic up to complex/advanced screen-menus?

To answer this questions, pls help us by showing links which permit us to download. And by sharing your source-code available for public.

Screenshoot attached herein, is a sample screen handle we need to implement on our application, ASAP. Being programmers for long time, we need any advanced skill in order to satisfy our users/clients currently still using our DOS-apps-versions.

You can start with Your HMG Directory\SAMPLES\Basics\TUTORIAL folder. It contains various tutorials for basic programmers. Then you can see basic and controls sub-folders of samples. I don’t think that any advanced skill set is required to satisfy our existing DOS clients. Actually ther will be happy to update their programs to Windows version as it is user friendly and more flexible.

2) How to avoid one app/EXE is double-run by users in the same computer?

This problem never arise under DOS who own a single window. I noticed when exercising HMG-ID (executing IDE.EXE) to build project, the RUN (F5) function fails to detect the problem. that’s way HMG-IDE made run-time error as if the mistake came from source program.

Yes, it is a valid point. In HMG-IDE previous version there was an error marking ‘Is the program still running?’. I don’t know what happened to that in the recent versions. I will request Claudio to look into this. Thanks for reporting.

3) Why stable version release from official Harbour-Project differ from this forum?

The project says the latest stable version is 3.0.0. while this forum says HMG 3.3.1. Any clarification in this matter is urgently needed to avoid confusion.

Because they are entirely different projects. As I have discussed earlier, HMG is based on Harbour. But it is a bundle by itself. Some major implementations have been made after the versions HMG 3.0. Introducing Unicode in 3.1. Made it to a stable version in 3.2. And the latest and significant achievement is HMG in 64 Bits, which made it to 3.3 series.

HMG Extended is also developed and released parallelly and they have their own version numbering system.

IMHO, we can use the latest stable versions for the development.

4) Pls help us describe what the differences between this 3 services you’ve been provided: Harbour Compiler, Harbour Mini GIU, Harbour-IDE. We need to know exactly when and why use them?

Harbour compiler is the core. Habour MiniGUI is the Win32 wrapper library to access the GUI aspects of the programs. HMG IDE is a tool to develop and build our software in Harbour MiniGUI.

You can use simply Harbour if you need only console mode. If you want GUI support, you can use Harbour MiniGUI and its build.bat ( even without using HMG IDE at all).

If you need Forms Designer and an easy build system, you can use HMG IDE which can co-ordinate your forms, database, resources (icons, pictures etc) and linking other third party libraries.

Sri Rathinagiri
Sivakasi, India

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Courtesy of author, this article borrowed from here.

Harbour Database Functions

Database Functions

AFields Fills referenced arrays with database field information
Alias Returns the alias name of a work area
BOF Test for the beggining-of-file condition
dbAppend Appends a new record to a database file
dbClearFilter Clears the current filter condiction in a work area
dbCloseAll Close all open files in all work areas.
dbCloseArea Close a database file in a work area
dbCommit Updates all index and database buffers for a given workarea
dbCommitAll Flushes the memory buffer and performs a hard-disk write
dbCreate Creates an empty database from a array
dbDelete Mark a record for deletion in a database
dbEval Performs a code block operation on the current Database
DBF Alias name of a work area
dbFilter Return the filter expression in a work area
dbGoBottom Moves the record pointer to the bottom of the database
dbGoto Position the record pointer to a specific location
dbGoTop Moves the record pointer to the top of the database
dbRecall Recalls a record previousy marked for deletion
dbSeek Searches for a value based on an active index
dbSelectArea Change to another work area
dbSetDriver Establishes the RDD name for the selected work area
dbSetFilter Establishes a filter condition for a work area
dbSkip Moves the record pointer in the selected work area
dbSkipper Helper function to skip a database
dbStruct Builds a multidimensional array of a database structure
dbUseArea Opens a work area and uses a database file
Deleted Tests the record’s deletion flag
EOF Test for end-of-file condition
FCount Counts the number of fields in an active database
FieldDeci Determines the number of decimal places of a given numeric field
FieldGet Obtains the value of a specified field
FieldName Return the name of a field at a numeric field location
FieldPos Return the ordinal position of a field
FieldPut Set the value of a field variable
FieldSize Determines the size of a given field
FieldType Determines the type of a given field
Found Determine the success of a previous search operation
Header Return the length of a database file header
LastRec Returns the number of records in an active work area or database
LUpdate Yields the date the database was last updated
RecCount Counts the number of records in a database
RecNo Returns the current record number or identity
RecSize Returns the size of a single record in an active database
Select Returns the work area number for a specified alias
Used Checks whether a database is in use in a work area

Harbour Commands

User Interface

? | ?? Display one or more values to the console
@…BOX Draw a box on the screen
@…CLEAR Clear a rectangular region of the screen
@…GET Build a new Get object and display it to the screen
@…PROMPT Paint a menu item and define a message
@…SAY Display data at a specified screen or printer row and column
@…TO Draw a single- or double-line box
ACCEPT* Place keyboard input into a memory variable
CLEAR TYPEAHEAD Empty the keyboard buffer
DISPLAY Display records to the console
INPUT* Enter the result of an expression into a variable
KEYBOARD Stuff a string into the keyboard buffer
LIST List records to the console
MENU TO Execute a lightbar menu for defined PROMPTs
READ Activate full-screen editing mode using Get objects
RESTORE SCREEN* Display a saved screen
SAVE SCREEN* Save the current screen to a buffer or variable
SET BELL Toggle sounding of the bell during full-screen operations
SET COLOR* Define screen colors
SET CONFIRM Toggle required exit key to terminate GETs
SET CONSOLE Toggle console display to the screen
SET CURSOR Toggle the screen cursor on or off
SET DECIMALS Set the number of decimal places to be displayed
SET DELIMITERS Toggle or define GET delimiters
SET ESCAPE Toggle Esc as a READ exit key
SET FIXED Toggle fixing of the number of decimal digits displayed
SET FORMAT* Activate a format when READ is executed
SET FUNCTION Assign a character string to a function key
SET INTENSITY Toggle enhanced display of GETs and PROMPTs
SET MESSAGE Set the @…PROMPT message line row
SET SCOREBOARD Toggle the message display from READ or MEMOEDIT()
SET TYPEAHEAD Set the size of the keyboard buffer
SET WRAP* Toggle wrapping of the highlight in menus
TEXT* Display a literal block of text
WAIT* Suspend program processing until a key is pressed

Database

APPEND BLANK Add a new record to the current database file
APPEND FROM Import records from a database (.dbf) file or ASCII text file
AVERAGE Average numeric expressions in the current work area
CONTINUE Resume a pending LOCATE
COPY STRUCTURE Copy the current .dbf structure to a new database (.dbf) file
COPY STRUCTURE EXTENDED Copy field definitions to a .dbf file
COPY TO Export records to a database (.dbf) file or ASCII text file
COUNT Tally records to a variable
CREATE Create an empty structure extended (.dbf) file
CREATE FROM Create a new .dbf file from a structure extended file
DELETE Mark records for deletion
DELETE TAG Delete a tag
FIND* Search an index for a specified key value
GO Move the pointer to the specified identity
INDEX Build an index file
JOIN Build new database file by merging from two work areas
LOCATE Search sequentially for a record matching a condition
PACK Remove deleted records from a database file
RECALL Restore records marked for deletion
REINDEX Rebuild open indexes in the current work area
REPLACE Assign new values to field variables
SEEK Search an order for a specified key value
SELECT Change the current work area
SET AUTOPEN Toggles automatic opening of a structural index file
SET AUTORDER Defines the default controlling index for automatically opened index files
SET AUTOSHARE Defines network detection for shared file access
SET DELETED Toggle filtering of deleted records
SET DESCENDING Change the descending flag of the controlling order
SET EXCLUSIVE* Establish shared or exclusive USE of database files
SET FILTER Hide records not meeting a condition
SET INDEX Open one or more order bags in the current work area
SET MBLOCKSIZE Change the block size for memo files
SET ORDER Select the controlling order
SET RELATION Relate two work areas by a key value or record number
SET SCOPE Change the boundaries for scoping keys in controlling order
SET SCOPEBOTTOM Change bottom boundary for scoping keys in controlling order
SET SCOPETOP Change top boundary for scoping keys in controlling order
SET SOFTSEEK Toggle relative seeking
SET STRICTREAD Toggles read optimization for database access
SET UNIQUE* Toggle inclusion of non-unique keys into an index
SKIP Move the record pointer to a new position
SORT Copy to a database (.dbf) file in sorted order
SUM Sum numeric expressions and assign results to variables
TOTAL Summarize records by key value to a database (.dbf) file
UNLOCK Release file/record locks set by the current user
UPDATE Update current database file from another database file
USE Open an existing database (.dbf) and its associated files
ZAP Remove all records from the current database file

Program Execution

CANCEL Terminate program processing
DO* Executes a function or procedure
QUIT Terminate program processing
RUN Execute a OS command or program
SET KEY Assign a procedure invocation to a key
NOTE* Place a single-line comment in a program file
SET PROCEDURE* Compile procedures and functions into the current object file

Variable Management

CLEAR ALL* Close files and release public and private variables
CLEAR GETS Release Get objects from the current GetList array
CLEAR MEMORY Release all public and private variables
CLEAR SCREEN Clear the screen and return the cursor home
RELEASE Delete public and private memory variables
RESTORE Retrieve memory variables from a memory (.mem) file
SAVE Save variables to a memory (.mem) file
STORE* Assign a value to one or more variables
SET EXACT Toggle exact matches for character strings

Device, Files & Folders

CLOSE Close a specific set of files
COMMIT Perform a solid-disk write for all active work areas
COPY FILE Copy a file to a new file or to a device
DELETE FILE Remove a file from disk
DIR* Display a listing of files from a specified path
ERASE Remove a file from disk
RENAME Change the name of a file
SET ALTERNATE Echo console output to a text file
SET DEFAULT Set the application default drive and directory
SET DEVICE Direct @…SAYs to the screen or printer
SET PATH Specify the CA-Clipper search path for opening files
TYPE Display the contents of a text file

Printer

EJECT Advance the printhead to top of form
SET MARGIN Set the page offset for all printed output
SET PRINTER Toggle echo of output to printer or set the print destination

Label / Report

LABEL FORM Display labels to the console
REPORT FORM Display a report to the console

Date & Time

SET CENTURY Modify the date format to include or omit century digits
SET DATE Set the date format for input and display
SET EPOCH Control the interpretation of dates with no century digits

All

SP_REPORTER

REPORTER()

  Short:
  ------
  REPORTER() Create, modify, execute reports

  Returns:
  --------
  Nothing

  Syntax:
  -------
  REPORTER([aFieldNames,aFieldTypes,aFieldLengths])

  Description:
  ------------
  Build/modify reports based on fields in database.
  Fields in database may be specified in arrays 1-3 which are
  [aFieldNames] field names [aFieldTypes] field types and
  [aFieldLengths] field lengths. All fields are used by default.

  Reporter allows a MAJOR and MINOR group, using the
  indexes currently available and open.

  Examples:
  ---------
   example 1:

   Use Customer
   REPORTER()

   example 2:
   USE Customer
   aFieldNames := {"fname","lname","mi"}
   aFieldTypes := {"C","C","C"}
   aFieldLens  := {15,35,1}
   REPORTER(aFieldNames,aFieldTypes,aFieldLens)

  Notes:
  -------
  Reporter() reports are stored in a DBF file. See the
  index for file structures. See SLSF_REPORT() for further info on
  the name and location of this file.

  Upgrade note:
  The look and feel have changed to one more uniform
  with other SuperLib functions.

  Source:
  -------
  R_REPORT.PRG

See Also : SLSF_REPORT()

Code blocks, inside and out

 

Code blocks, inside and out