Harbour Differences

Differences between Harbour and other compatible compilers ( xHarbour, Clipper, xBase++, CLIP, FlagShip )

 

Compile time support for merging multiple .prg modules
New language statements
FOR EACH
WITH OBJECT / END[WITH]
SWITCH / [ CASE / [EXIT] / … ] OTHERWISE / END[SWITCH]
BEGIN SEQUENCE [ WITH <ERRBLOCK> ] … END SEQUENCE
Extended codeblocks
Hash arrays
References to variables stored in arrays
Passing array and hash items by reference
Passing object variables by reference
Detached locals and references
Declaration and initialization of variables
Functions with variable number of parameters
Hb_ArrayToParams() function
Macros with declared symbols
Macro messages
Multivalue macros
Using [] operator for string items
Negative indexes in [] operator used to access items from tail
Using one character length string as numeric value
New bit operators
IN, HAS, LIKE operators
Pre/post incrementation/decrementation and <op>= operators
Global / global external (global_extern)
DATETIME/TIMESTAMP values
Literal date and TIMESTAMP values
Extended literal string in compiler and macrocompiler
Symbol items and function references
OOP scopes
OOP and multiinheritance
OOP and private/hidden datas
OOP and class object/class messages
Typed object variables
Object destructors
Scalar classes
Runtime class modification
Array and string preallocation
DIVERT statement
Namespaces
Multi window GTs and runtime GT switching
Multi thread support
Thread local work areas and concurrent work area access
Harbour tasks and MT support in DOS
Background task
Codeblock serialization / deserialization
Native RDDs
Regular expressions
INET sockets
I18N (internationalization) support
ZLIB (compression/decompression)
Serial port support
Macro compiler
Compiler library
PP library
Lexer
Contrib libraries
Portability
C level compatibility
HBRUN / XBSCRIPT
HBMK2
Performance and resource usage

This list borrowed from Harbour github documentation; please look at there for details.

 

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.

DATA

 

DATA

 

Alternate syntax for VAR: instance variable for the objects.

Syntax

      DATA <DataName1> [,<DataNameN>] [ AS <type> ] [ INIT <uValue> ]
      [[EXPORTED | VISIBLE] | [PROTECTED] | [HIDDEN]] [READONLY | RO]

Arguments

<DataName1> Name of the DATA

<type> Optional data type specification from the following: Character, Numeric, Date, Logical, Codeblock, Nil.

<uValue> Optional initial value when creating a new object.

EXPORTED Specifies that this DATA is accessible to functions and methods outside of the class. VISIBLE is a synonym for EXPORTED.

PROTECTED Specifies that this DATA is only accessible to functions and methods within this class and its subclasses.

HIDDEN Specifies that this DATA is only accessible to the class where it was defined, and is not inherited by the subclasses.

READONLY Restricts assignment to the variable. If specified with the EXPORTED clause, assignment is only permitted from the current class and its subclasses. If specified with the PROTECTED clause, assignment is only permitted from the current class. RO is a synonym for READONLY.

Description

DATA elements can also be thought of as the “properties” of an object. They can be of any data type, including codeblock. Once an object has been created, the DATA elements are referenced with the colon (:) as in MyObject:Heading := “Last name”. Usually a class also defines methods to manipulate the DATA.

You can use the “AS <type>” clause to enforce that the DATA is maintained as a certain type. Otherwise it will take on the type of whatever value is first assigned to it.

Use the “INIT <uValue>” clause to initialize that DATA to <uValue> whenever a new object is created.

VAR can be a synonym for DATA, or it can use a slightly different syntax for compatibility with other dialects.

Examples

      CREATE CLASS TBColumn

         DATA Block      // Code block to retrieve data for the column
         DATA Cargo      // User-definable variable
         DATA ColorBlock // Code block that determines color of data items
         DATA ColSep     // Column separator character
         DATA DefColor   // Array of numeric indexes into the color table
         DATA Footing    // Column footing
         DATA FootSep    // Footing separator character
         DATA Heading    // Column heading
         DATA HeadSep    // Heading separator character
         DATA Width      // Column display width
         DATA ColPos     // Temporary column position on screen

         METHOD New()    // Constructor

      ENDCLASS

Compliance

Harbour

Platforms

All

Seealso

Object Oriented Programming, CLASS, METHOD, CLASSDATA, VAR

CLASSDATA

 

CLASSDATA

Define a CLASSDATA variable for a class (NOT for an Object!)

Syntax

      CLASSDATA <DataName1> [,<DataNameN>] [ AS <type> ] [ INIT <uValue> ]

Arguments

<DataName1> Name of the DATA

<type> Optional data type specification from the following: Character, Numeric, Date, Logical, Codeblock, Nil

<uValue> Optional initial value at program startup

Description

CLASSDATA variables can also be thought of as the “properties” of an entire class. Each CLASSDATA exists only once, no matter how many objects are created. A common usage is for a counter that is incremented whenever an object is created and decremented when one is destroyed, thus monitoring the number of objects in existence for this class.

You can use the “AS <type>” clause to enforce that the CLASSDATA is maintained as a certain type. Otherwise it will take on the type of whatever value is first assigned to it. Use the “INIT <uValue>” clause to initialize that DATA to <uValue> whenever the class is first used.

Examples

      CREATE CLASS TWindow
         DATA   hWnd, nOldProc
         CLASSDATA lRegistered AS LOGICAL
      ENDCLASS

Compliance

Harbour

Platforms

All

Seealso

Object Oriented Programming, CLASS, METHOD, DATA

HBClass()

HBClass()

HBClass() is used in the creation of all classes

Syntax

      oClass := HBClass():New("TMyClass")

        -or-

      HBClass() is usually accessed by defining a class with the commands
      defined in hbclass.h:

        CLASS HBGetList    // Calls HBClass() to create the HBGetList class
           ...
        ENDCLASS

Returns

An instance of the HBClass Class. This special object’s :New() method can then create the classes you define.

Description

HBClass is a class that … The class methods are as follows:

New() Create a new instance of the class

Examples

      FUNCTION TestObject()
         LOCAL oObject

         oObject := HBClass():New( "TMyClass" )
         oObject:End()

         RETURN NIL

Compliance

Object Oriented syntax in Harbour is compatible with CA-Cl*pper.

However CA-Cl*pper only allowed creation of objects from a few standard classes, and did not let the programmer create new classes.

In Harbour, you can create your own classes–complete with Methods, Instance Variables, Class Variables and Inheritance. Entire applications can be designed and coded in Object Oriented style.

Platforms

All

Files

Library is core

Seealso

__objHasData(), Object Oriented Programming, CLASS

VAR

VAR

Alternate syntax for VAR: instance variable for the objects.

Syntax

      VAR <DataName1> [, <DataNameN>] [ AS <type> ] [ INIT <uValue> ]
      [[EXPORTED | VISIBLE] | [PROTECTED] | [HIDDEN]] [READONLY | RO]

Arguments

<DataName1> Name of the VAR

<type> Optional data type specification from the following: Character, Numeric, Date, Logical, Codeblock, Nil.

<uValue> Optional initial value when creating a new object.

EXPORTED Specifies that this VAR is accessible to functions and methods outside of the class. VISIBLE is a synonym for EXPORTED.

PROTECTED Specifies that this VAR is only accessible to functions and methods within this class and its subclasses.

HIDDEN Specifies that this VAR is only accessible to the class where it was defined, and is not inherited by the subclasses.

READONLY Restricts assignment to the variable. If specified with the EXPORTED clause, assignment is only permitted from the current class and its subclasses. If specified with the PROTECTED clause, assignment is only permitted from the current class. RO is a synonym for READONLY.

Description

VAR elements can also be thought of as the “properties” of an object. They can be of any data type, including codeblock. Once an object has been created, the VAR elements are referenced with the colon (:) as in MyObject:Heading := “Last name”. Usually a class also defines methods to manipulate the VAR.

You can use the “AS <type>” clause to enforce that the VAR is maintained as a certain type. Otherwise it will take on the type of whatever value is first assigned to it.

Use the “INIT <uValue>” clause to initialize that VAR to <uValue> whenever a new object is created.

VAR can be a synonym for VAR, or it can use a slightly different syntax for compatibility with other dialects.

Examples

      CREATE CLASS TBColumn

         VAR Block      // Code block to retrieve data for the column
         VAR Cargo      // User-definable variable
         VAR ColorBlock // Code block that determines color of data items
         VAR ColSep     // Column separator character
         VAR DefColor   // Array of numeric indexes into the color table
         VAR Footing    // Column footing
         VAR FootSep    // Footing separator character
         VAR Heading    // Column heading
         VAR HeadSep    // Heading separator character
         VAR Width      // Column display width
         VAR ColPos     // Temporary column position on screen

         METHOD New()   // Constructor

      ENDCLASS

Compliance

Harbour

Platforms

All

Seealso

Object Oriented Programming, CLASS, METHOD, CLASS VAR, VAR

ON ERROR

ON ERROR

Designate a method as an error handler for the class

Syntax

      ON ERROR <MethodName>( [<params,...>] )

Arguments

<MethodName> Name of the method to define

<params, …> Optional parameter list

Description

ON ERROR is a synonym for ERROR HANDLER. It names the method that should handle errors for the class being defined.

Examples

      CREATE CLASS TWindow
         ON ERROR  MyErrHandler()
      ENDCLASS

Compliance

Harbour

Platforms

All

Seealso

Object Oriented Programming, ERROR HANDLER, CLASS, METHOD, DATA