Contributed works of Andrés González López
Anchor Windows (ON MOUSEDRAG)
Bos Taurus – Incredible !!!
DEFINE REPORT (with filtered data)
Demo Debug
Generate PDF files
Improved interfaces (Label Button)
My color list (i_color.ch)
Anchor Windows (ON MOUSEDRAG)
Bos Taurus – Incredible !!!
DEFINE REPORT (with filtered data)
Demo Debug
Generate PDF files
Improved interfaces (Label Button)
My color list (i_color.ch)
File Name: HMG.3.3.1.exe
File Size: 46.91 MB
Date: 15. July 2014
Description:
-HMG 3.3.1 (Stable) 2014/07/15
– Updated to latest Harbour Nightly Build (2014-07-15)
– New property in Label control
– NoPrefix
– New New property in DatePicker control
– FORMAT <cFormatDate> (see demo)
– New Now all controls (Button, CheckButton, ToolBarButton, ComboBox, Grid, Tab, Tree, Menu, etc) loaded images: BMP, GIF, TIF, JPG and PNG
– New Now all controls (Button, CheckButton, ToolBarButton, ComboBox, Grid, Tab, Tree, Menu, etc) support the NOTRANSPARENT property
– New Grid control support the NOTRANSPARENTHEADER property
– New Print images in formats: BMP, GIF, JPG, TIF, WMF, EMF, CUR and PNG.
- @ <nRow> , <nCol> PRINT IMAGE <cImageFileName> | <cImageResourcename> WIDTH <nWidth> HEIGHT <nHeight> [ STRETCH ] [ TRANSPARENT ] [ TRANSPARENTCOLOR anTransparentColor ]
– New functions for read Keyboard and Mouse (see doc)
– SET CONTROL <ControlName> OF <FormName> ONKEYEVENT <FuncName> | NIL
– SET CONTROL <ControlName> OF <FormName> ONMOUSEEVENT <FuncName> | NIL
– HMG_GetOnKeyControlIndex ( [ @nSubIndex ] ) –> nIndex
– HMG_GetOnMouseControlIndex ( [ @nSubIndex ] ) –> nIndex
– New functions for control edge (see doc)
– SET CONTROL <ControlName> OF <FormName> CLIENTEDGE
– SET CONTROL <ControlName> OF <FormName> STATICEDGE
– SET CONTROL <ControlName> OF <FormName> NOTEDGE
– New Functions:
– GetKeyboardLayoutName()
– ActivateKeyboardLayout()
– GetKeyboardLayout()
– GetKeyboardLayoutList()
– LoadKeyboardLayout ()
– UnloadKeyboardLayout()
– TerminateProcess ( [ nProcessID ] , [ nExitCode ] )
– GetWindowThreadProcessId (hWnd, @nThread, @nProcessID)
– IsWow64Process ( [ nProcessID ] ) –> return lBoolean
– return TRUE if a 32-bit application is running under 64-bit Windows (WOW64)
– return FALSE if a 32-bit application is running under 32-bit Windows
– return FALSE if a 64-bit application is running under 64-bit Windows
– WOW64 is the x86 emulator that allows 32-bit Windows-based applications to running on 64-bit Windows
– New: VirtualKeyboard (see doc)
– VirtualKeyboard.OPEN [ SHOW ]
– VirtualKeyboard.OPEN HIDE
– VirtualKeyboard.Show
– VirtualKeyboard.Hide
– VirtualKeyboard.Release
– VirtualKeyboard.IsRelease
– VirtualKeyboard.IsOpen
– VirtualKeyboard.IsVisible
– VirtualKeyboard.IsMinimize
– VirtualKeyboard.IsMaximize
– VirtualKeyboard.Handle
– VirtualKeyboard.Title [ := | –> ] cTitle
– VirtualKeyboard.Row [ := | –> ] nRow
– VirtualKeyboard.Col [ := | –> ] nCol
– VirtualKeyboard.Width [ := | –> ] nWidth
– VirtualKeyboard.Height [ := | –> ] nHeight
– VirtualKeyboard.FileName –> “OSK.EXE”
– VirtualKeyboard.FullFileName –> GetSystemDir()+”\OSK.EXE”
– Fixed Numeric Textbox bug –> http://hmgforum.com/viewtopic.php?p=34890#p34890
– Fixed bug in Grid control build in 64-bits –> http://hmgforum.com/viewtopic.php?p=34946#p34946
– Fixed bug in FocusedControl Property (reported by Tiampei)
– Fixed Windows problem of overlap between ToolBar Bottom and StatusBar
– HMG IDE
-Fixed when not found the text editor calls notepad.exe of windows (reported by Roberto Lopez)
-Updated Polish language in Unicode (contributed by Marek)
HMG.3.3.1 DOC.zip 2.02 MB
HMG.3.3.1 HARBOUR.zip 21.17 MB
HMG.3.3.1 hfcl.zip 85.50 KB
HMG.3.3.1 IDE.zip 1.75 MB
HMG.3.3.1 IDE_ANSI.zip 1.74 MB
HMG.3.3.1 INCLUDE.zip 207.78 KB
HMG.3.3.1 lib.zip 588.89 KB
HMG.3.3.1 MINGW.zip 80.84 MB
HMG.3.3.1 RESOURCES.zip 97.55 KB
HMG.3.3.1 SAMPLES.zip 9.99 MB
HMG.3.3.1 SOURCE.zip 697.39 KB
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 |
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 |
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 |
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 |
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 |
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 FORM | Display labels to the console |
REPORT FORM | Display a report to the console |
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 |
S1LABEL() Short: ------ S1LABEL() Prints a single label Returns: -------- Nothing Syntax: ------- S1LABEL(cLblfile) Description: ------------ Prints a single label (1 or more copies) for the current record, based on the dimensions and contents definitions in .LBL file name <cLblfile>. The dimensions and contents are figured, and then presented for printing and/or editing. Examples: --------- setkey(K_F10,{||S1LABEL("MAILING.LBL")} ) // sets key F10 to call this // as a popup Source: ------- S_1LABEL.PRG
* Harbour Example lists the volume serial numbers * and volum labels of all drives in the system ( PC ) * * Build : * * c:\harbour\bin\hbmk2 VolInfo -lhbct -lxhb -run * PROCEDURE Main() LOCAL nDrive, cDrive, nSerial, cSerial SetMode( 25, 80 ) CLS SETPOS( 5, 0 ) FOR nDrive := 1 TO 26 cDrive := CHR( 64 + nDrive ) + ":\" nSerial := VolSerial( cDrive ) IF nSerial # -1 cSerial := NTOC( nSerial, 16 ) ? cDrive, STUFF( cSerial, 5, 0, ":" ) + " " + GetVolInfo( cDrive ) ENDIF NEXT @ MAXROW(), 0 WAIT "EOF VolInfo.prg" RETURN
Don’t worry ! This is the last; and important.
Extract DEFINE LABEL – END LABEL structure or @ …,… LABEL command ( which one is currently exist) and then instead of them place this line :
MsgBox( "Hello World !" )
In HMG, there are a lot of message functions, with name prefixed by “Msg“; for details please look at HMG Message Functions page.
After building and running, try a more important feature: reduce your program to these minimum size:
#include <hmg.ch>
PROCEDURE Main
MsgBox( "Hello World !" ) RETURN // Main()
In fact, as a rule, every HMG project must have one and only one “Main” window. This message functions are exception of this rule. If you have only message function(s) you can build a program without main window.
In the our first example in first Quick Start page, we wrote the “Hello World” clause on the title bar. Now, let’s put it on the form.
Build a new project with “HelloWorld2” name, copy HelloWord.prg to HelloWorld2.prg and change it as below:
#include <hmg.ch> PROCEDURE Main() DEFINE WINDOW frmHWLabel ; AT 0,0 ; WIDTH 400 ; HEIGHT 200 ; TITLE 'Hello World-2' ; MAIN DEFINE LABEL lblHello ROW 75 COL 125 VALUE "Hello World !" FONTNAME "Lucida" FONTSIZE 16 END LABEL END WINDOW ACTIVATE WINDOW frmHWLabel RETURN // Main()
DEFINE LABEL and END LABEL statements are for “Label” definition structure for the a window ( in this example Windows named as “frmHWLabel ” ). Label itself must have a name (“lblHello” in this example), and this name must be unique, such as a variable name. Beginning these names with a descriptive prefix ( “lbl” in the example) is a good programming practice.
Between DEFINE – END statements there are main properties of this label. Row, col numbers ( in pixels of course),value (for labels, value is a string constant to write in the your form/window) and font properties (NAME and SIZE)
Almost every GUI control definitions HMG have two syntax : With DEFINE and END structure and with @ command.Thus in the above example instead of DEFINE LABEL and END LABEL structure, you can use alternate @ syntax :
@ 75, 125 LABEL lblHello ; VALUE "Hello World !" ; FONT "Lucida" ; SIZE 16
A last note for this example : place
CENTER WINDOW frmHWLabel
statement END WINDOW statement and notice that how much HMG is powerful.
Databases (PDF)
Author : G.C. Reddy
We are continuing with Viva_HMG.hbp, Main.prg and Main.fmg. We have assign real actions other than MsgBox() to our two buttons now : Open File and Edit Record. Open File not required GUI controls ( at least for now ), so we can begin with it: For Open File we need a file ( a table ) first: it’s here; a table with four field: Clients.dbf :
No: Field Name Type Width Dec --- --------- ---- ----- --- 1 CLI_ID N 5 0 2 CLI_SNAM C 12 0 3 CLI_NAME C 12 0 4 CLI_TLF C 11 0
And then add a little routine to Main.prg for open (USE) it:
PROCEDURE OpenTable()
IF FILE( "CLIENTS.DBF" )
USE CLIENTS
ELSE
MsgStop( "Clients.dbf file not found !")
ENDIF
RETURN // OpenTable()
And assign this procedure to ACTION of Open File button.
Now, we can begin Edit Record task. For this task we need a separate form, a sub form. Then let’s begin. “New form” from tool-bar and assign a name : EditReco. Assign a title : “Edit Record”, a type : MODAL. Our table has four fields, so we need four LABEL first:
Names : lblCLI_ID, lblCLI_SNAM, lblCLI_NAME, lblCLI_TLF;
Values ( Captions ) : ID, Surname, Name, Tlf
Rows : 60, 100, 140, 180 Col : 60
Cols : 60, 60, 60, 60
Widths : 70, 70, 70, 70
Alignement : RIGHT, RIGHT, RIGHT, RIGHT
We can see our job at work:
Now we need a place for display the current data and accept user input. The control for this purpose is text box. So we need to define four text boxes for each field in the table.
The button of text box in the IDE tool bar is :
Names : txbCLI_ID, txbCLI_SNAM, txbCLI_NAME, txbCLI_TLF;
Rows : 55, 95, 135, 175
Col : 140
DataTypes : First : NUMERIC, others : CHARACTER
We can see our job at work:
Well …
But where are table data ?
To see table data we need assign field values to text boxes as values.
Again, a little procedure:
PROCEDURE ReadData() EditReco.txbCLI_ID.Value := CLIENTS->CLI_ID EditReco.txbCLI_SNAM.Value := CLIENTS->CLI_SNAM EditReco.txbCLI_NAME.Value := CLIENTS->CLI_NAME EditReco.txbCLI_TLF.Value := CLIENTS->CLI_TLF RETURN // ReadData()
and a call command for this procedure to ON INIT event of EditReco form.
The result :
Everything is OK ?
No !
This is only first record of table; how we will see others ?
Yes, we need now yet another feature: navigation; that is travelling between records of table.
But before navigation, we have a problem: Open Table must be processed before Edit Record.
Otherwise a run time error will occurs: Alias does not exist.
What we can do?
– Discard Open Table button, open the table automatically; at beginning of program or at beginning of editing.
– Before editing, check the table, if doesn’t open,
– a) open automatically or
– b) warn user and don’t load Edit Table form.
Probably most convenient is : disable Edit Record button until table is open.
First a mini procedure :
PROCEDURE Initialize()
Main.btnEditRec.Enabled := .F.
RETURN // Initialize()
And then add this procedure ON INIT event of form main:
Last point: enable it after USE table:
PROCEDURE OpenTable()
IF FILE( "CLIENTS.DBF" )
USE CLIENTS
Main.btnEditRec.Enabled := .T.
ELSE
MsgStop( "Clients.dbf file not found !")
ENDIF
RETURN // OpenTable()
Run and see:
Before Open File :
After Open File:
Now we can pass to navigation:
We need seven buttons: Go Top, Go Next, Go Previous, Go Last, Save, Discard, Exit.
Name: btnGoTop, Caption : Top, Col : 50, Row: 220, Height: 28, Width: 60
Name: btnGoNext, Caption : Next, Col : 130, Row: 220, Height: 28, Width: 60
Name: btnPrevious, Caption : Previous, Col : 200, Row: 220, Height: 28, Width: 60
Name: btnGoLast, Caption : Last, Col : 270, Row: 220, Height: 28, Width: 60
Name: btnSave Caption : Save, Col : 380, Row: 60, Height: 28, Width: 100
Name: btnDiscard, Caption : Discard, Col : 380, Row: 140, Height: 28, Width: 100
Name: btnExit, Caption : Exit, Col : 380, Row: 220, Height: 28, Width: 100
Common: Font Name: Tahoma, Font Size: 9
Actions :
btnGoTop: ( DBGOTOP(), ReadData() )
btnGoNext: ( DBSKIP(), ReadData() )
btnPrevious: ( DBSKIP( -1 ), ReadData() )
btnGoLast: ( DBGOBOTTOM(), ReadData() )
btnSave: SaveData()
btnDiscard: ReadData()
btnExit: ThisWindow.Release
Note that actions of four first buttons include two actions, separated by comma and enclosed by parenthesis. With this notation we can define more than one action together.
SaveData() is the inverse of ReadData(): copy values of text boxes to table fields.
PROCEDURE SaveData() // Save data from text boxes to table
CLIENTS->CLI_ID := EditReco.txbCLI_ID.Value
CLIENTS->CLI_SNAM := EditReco.txbCLI_SNAM.Value
CLIENTS->CLI_NAME := EditReco.txbCLI_NAME.Value
CLIENTS->CLI_TLF := EditReco.txbCLI_TLF.Value
RETURN // SaveData()
Discard is simply re-reading data from table.
The result:
To be continued …