Showing posts with label HMG. Show all posts
Showing posts with label HMG. Show all posts

Friday, September 28, 2012

HMG 3.0.44 Released on 3rd Sept 2012

HMG 3.0.44

Hi all,

I am so happy to upload the new test version HMG 3.0.44.

It can be downloaded from site (37.51 MB)

Alternatively you can download from sourceforge.net too.

Code:
- HMG 3.0.44 (Test) 2012/09/03 Changelog:
   - Fixed Portuguese language definitions (Thanks to Ronaldo (Chacal.GO))
   - New GridEx dynamic grid functionality and see the sample in HFCL samples directory. (Thanks to Claudio Soto)
      - GRID_ColumnCount         ---> Return the Number of Column on GRID
      - GRID_AddColumnEx         ---> Complement of Method:  AddColumn (nColIndex)
      - GRID_DeleteColumnEx      ---> Complement of Method:  DeleteColumn (nColIndex)
      - GRID_GetColumnControlsEx ---> Return Array with Controls of Column(nColIndex) ==> {cCAPTION, nWIDTH, nJUSTIFY, aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK}
      - GRID_GetColumnControl    ---> Return specific Control of Column(nColIndex) ==> [cCAPTION, nWIDTH, nJUSTIFY, aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK]
      - GRID_SetColumnControl    ---> Set specific Control of Column(nColIndex)    ==> [cCAPTION, nWIDTH, nJUSTIFY, aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK]
      - GRID_GetColumnDisplayPos ---> Get the position of Column(nColIndex) in that display in the GRID
      - GRID_SetColumnDisplayPos ---> Set the position of Column(nColIndex) in that display in the GRID
      - GRID_GetColumnWidthDisplay -> Get the Width of Column(nColIndex) in that display in the GRID
      - GRID_SetBkImage          ---> Set background image in Grid

_________________

 rathinagiri
East or West HMG is the Best.
South or North HMG is worth.

Thursday, July 28, 2011

Harbour MiniGUI 1.9 Extended Edition (Build 98) Released on 28th July 2011

Hi All,

The Harbour MiniGUI 1.9 Extended Edition (Build 98) setup is published at the following URL:

http://hmgextended.com/files/CONTRIB/hmg-1.9-98-setup.zip

and a lite MinGW-based build 98 archive is placed at the following URL:

http://hmgextended.com/files/CONTRIB/hmg98-mingw.zip

There is the following changelog for this build:

2011/07/27: Build 98 (HMG 1.9 Extended Edition) Published.
* New: Added 'ON MOUSEHOVER' and 'ON MOUSELEAVE' events (optional) for LABEL control.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see demo in folder \samples\Basic\Label)
* New: Added 'ON MOUSEHOVER' and 'ON MOUSELEAVE' events (optional) for IMAGE control.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see demo4.prg in folder \samples\Basic\Mouse_Coords)
* Enhanced: The Image control supports the 'Transparent' clause now.
Warning: This clause works properly for bitmaps with 8 bpp (256 colors) or less.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see demo in folder \samples\Advanced\CONTROL_
PANEL)
* Updated: Synchronized Extended HMG with Official HMG 2.0.001:
- New: RIGHTALIGN property for HYPERLINK control
- New: CENTERALIGN property for HYPERLINK control
- Redesigned: HYPERLINK control (Works on top of LABEL control now).
(see demo in folder \samples\Basic\HYPERLINK)
* Enhanced: Added the following features to batch\Compile.bat file:
- Merged the functionality of CompileMT.bat into Compile.bat, by adding
an /MT flag to Compile.bat and using it in the library list build.
- For debug and mixed mode executables, eliminated the need for the two
special lines in your source code.
Contributed by Kevin Carmody <i@kevincarmody.com>
* Updated: MPM utility:
- Added a multithread option to the Options tab.
- Corrected a support for debug and mixed mode executables.
- Fixed a bug that occurred when you maximized the main window or
help window and then restored it at startup.
Contributed by Kevin Carmody <i@kevincarmody.com>
(see in folder \Utils\MPM)
* Updated: HbSQLite3 library source code (see in folder \Source\HbSQLite3):
- update for using SQLITE3 version 3.7.7.1
Contributed by Grigory Filatov <gfilatov@inbox.ru>
* Updated: Harbour Compiler 3.0.0 final (SVN 2011-07-17 16:34).
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(look at ReadMe.txt in folder \harbour)
* New: 'HMG Cursor' sample. Borrowed from HMG 4 project.
Adapted by Grigory Filatov <gfilatov@inbox.ru>
(see in folder \samples\Basic\CURSOR)
* New: 'Image-based ToolBar' sample. Requested by Daniel Maximiliano.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see demo3.prg in folder \samples\Basic\TOOLBAR)
* New: 'Control Panel' sample.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see in folder \samples\Advanced\CONTROL_PANEL)
* New: 'HMG ReadXLS' sample.
Contributed by Isma Elias <farfa890@gmail.Com>
(see in folder \samples\Advanced\ReadXLS)
* Updated: 'Free Memory' sample.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see in folder \samples\Applications\FREE_MEMORY)

This release of MiniGUI is considered stable and ready for production use.

--
Best Regards,
Grigory Filatov
[MiniGUI Team]

Thursday, July 21, 2011

Updated version of HMG 3.0.37a (2011.06.24) Ready !

The updated version of HMG 3.0.37a (2011.06.24) can be downloaded from

http://www.hmgforum.com/site (30 MB)

- HMG 3.0.37a (Test) 2011/06/24 Changelog:
- Updated IDE/build.bat/hmg.hbc by Roberto Lopez accommodating /c (console mode) and debugger.
- Included xbase.xml for Syntax Highlighting in Notepad++. Please see readmenotepad++.txt in HMG Folder\notepad++ directory. (Thanks to MigSoft)



rathinagiri

More at http://www.hmgforum.com/viewtopic.php?f=2&t=2007

- HMG 3.0.37 (Test) 2011/06/20 Changelog:
   - Built using latest Harbour Nightly Build (2011/06/18)
   - Updated Build.bat by Roberto Lopez
   - Updated ide.exe by Roberto Lopez
   - Fixed MultiSelect Grid set value (Thanks to Grigory Filatov)
   - New MixedConsole Sample by Roberto Lopez
   - Fixed Memory Leak Problem (Thanks to Grigory Filatov)
   - Changed the program editor to Notepad++

Sunday, May 22, 2011

Harbour MiniGUI 1.9 Extended Edition (Build 96) Released on 18th May 2011

Hi All,

The Harbour MiniGUI 1.9 Extended Edition (Build 96) setup is published at the following URL:

http://hmgextended.com/files/CONTRIB/hmg-1.9-96-setup.zip

There is the following changelog for this build:

2011/05/18: Build 96 (HMG 1.9 Extended Edition) Published.
* Fixed: Problem with appearance the RichEdit control in Win2000
(introduced in the build 94).
Bug was reported by Paolo Russignan <paolorus@yahoo.it>.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
* Fixed: Problem with negative decimal numbers and 'E' picture in GetBox control.
Bug was reported by Ari Lehtinen <ari.lehtinen@pp8.inet.fi>.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
* New: SET GLOBAL HOTKEYS ON | OFF command. When set to ON, the defined hotkeys
are available from everywhere (default is OFF).
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see demo in folder \samples\Advanced\CDejector)
* New: PostGreSQL wrapper support for MiniGUI (see in folder \Source\HbPgSql).
Contributed by Mitja Podgornik <yamamoto@rocketmail.com>
(see console demo in folder \samples\Basic\PostgreSQL)
* Changed: Minor simplification of Browse functions code.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
* Changed: Added parameters error checking in the Grid columns autofitting.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see demo.prg in folder \samples\Basic\Grid)
* Updated: Batch file hbmk2.bat for compiling with HBMK2 utility:
- Added: switch /n for 'no run after build' mode.
Suggested by Paolo Russignan <paolorus@yahoo.it>.
- Added: switch /nh for 'no head incremental' mode.
Suggested by Mitja Podgornik <yamamoto@rocketmail.com>.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see hbmk2.bat in folder \Batch)
* Updated: HbSQLite3 library source code (see in folder \Source\HbSQLite3):
- update for using SQLITE3 version 3.7.6
Contributed by Grigory Filatov <gfilatov@inbox.ru>
* Updated: Adaptation FiveWin Class TSBrowse 9.0 in HMG:
- Modified: Added minimal columns width at resizing in DrawHeaders method.
The variable ::nMinWidthCols may be rewritten at runtime (default is 4).
Requested by Simon Norbert <simon.n@t-online.hu>.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
* Updated: Harbour Compiler 2.1.0rc2 (SVN 2011-05-15 17:19).
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(look at ReadMe.txt in folder \harbour)
* Updated: 'CD Ejector' sample:
- Enhanced: hotkeys Ctrl+Alt+[A|E|L] are available from everywhere.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see in folder \samples\Advanced\CDejector)
* Updated: 'Start Button Image Control' sample:
- Enhanced: hotkey Ctrl+F6 is available from everywhere.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see in folder \samples\Advanced\StartButton)
* Updated: 'Sticky Notes' sample.
Bug was reported by Jaroslav Janik <jaroslav.janik@siemens.com>.
Contributed by Grigory Filatov <gfilatov@inbox.ru>
(see in folder \samples\Applications\
StickyNotes)

This release of MiniGUI is considered stable and ready for production use.

--
Best Regards,
Grigory Filatov
[MiniGUI Team]

Monday, March 21, 2011

HMG.3.0.36 is now Compatible with HB 2.1rc2

CCH : Thanx to Rathi from the HMG Forum, HMG 3.0.36 can now be compiled with Harbour 2.1 rc2
Code:
- HMG 3.0.36 (Test) 2011/03/19 Changelog:
   - Built using latest Harbour Nightly Build (2011/03/16)
   - Following Modifications done on official HMG 3.0.35
     * Edit in \hmg\source\c_media.c - Replace line no. 144 with the following:
     //    hwnd=MCIWndCreate((HWND) hb_parnl(1),NULL,Style,hb_parc(2));
     * Edit in \hmg\source\h_init.prg - Replace line no. 628 with the following:
         _HMG_SYSDATA [ 306 ] := ( EMPTY( CreateMutex( , .T., strtran(GetProgramFileName(),'\','_') ) ) .OR. (HMGGetLastError() > 0) )
     * Edit in \hmg\source\c_winapimisc.c - Replace line no. 416 to 419 with the following:
      HB_FUNC ( HMGGETLASTERROR )
      {
        hb_retnl( (LONG) GetLastError() ) ;
      }
     * Edit in \hmg\source\h_windows.prg. Replace line no 5588 with the following:
            uResult := CallDll32 ( "IsAppThemed" , "UXTHEME.DLL"  )
   - Changed HMG Build system to hbmk2 by adapting HMG 4 and latest Harbour method.
   - Changed HMG Build Application System by adapting HMG 4. Please make use of newbuild.bat in samples folder or buildapp.bat in hmg main folder.   

Wednesday, February 16, 2011

How to compile a HMG application with hbmk2 ?

All along, I have always use HMG-IDE by Roberto Lopez to compile  Harbour Minigui  Win 32 apps. The process is actually simple. For example, all I needed to do was to create a project with the IDE and add  a list of the PRGs that needed to be compiled.

If the name of the project is FRS4HMG, frs4hmg.hbp will be created as follows :-

frs4hmg.hbp
=========
frs4w764.prg
lock.prg

By running the frs4hmg project, FRS4HMG.EXE is created

After discovering the versatility of hbmk2 and especially after successfully using hbmk2 to compile a gtWVG app, I was motivated to try the same with building a HMG app with hbmk2.

I took a look at the frs4hmg.hbp and noticed that there was no HMG libs at all. I then looked at the build.bat in the HMG root folder and was overwhelmed :-) As usual, I posted my issue at the HMG Forum and an Italian Member, Luigi was kind enough to walk me through and highlight that it was just impossible to do so with Harbour 2.1


Quote by Luigi

In addition, I have tried to compile HMG3 with the new version of the Harbour compiler but I got many warning with the option /w0 (with /w3, of course, does not generate the hmg library). The generation of an executable is, in any case, impossible for many mistakes: for example with hbmzip (used by Hmg).

frs4hmg.hbp (after looking at Luigi's feedback)
=========

-oFRS4HMG.exe
-prgflag= -w3 -es2 -gtgui
-cflag=-O3

-lhmg -lhbmzip -lhbwin -lhbct -lhbmisc -lxhb -lvfw32 -lmsvfw32

frs4hmg.hbc

frs4w764.prg
locks.prg

frs4hmg.hbc
=========

incpaths=c:\hmg\include
libpaths=c:\hmg\lib


I then hbmk2 frs4hmg.hbp but there were lots of undefined functions in lhmg etc.

Taking the cue, I changed the PATH under environmental variables in Win 7 to C:\hb20;Hb20\bin and

hbmk2 frs4hmg.hbp and bingo FRS4HMG.EXE was duly created !

Friday, August 27, 2010

Future Directions for HMG - Roberto Lopez - 12th August 2010

CCH : From the HMG Forum
 
It is very clear for me that Windows is the past.

Devices not having Windows installed are becoming more and more popular since the people don't care about that so much.

QT framework (accessible to us via HBQT) provides compatibility with the following platforms:

- Embedded Linux
- Mac OSX
- Windows
- Linux/X11
- Windows CE/Mobile
- Symbian
- Maemo

Is obvious that is time to change, so I've decided the following:

1. I'll stop any new development based on Windows API (HMG 3.0 will be the last one).

2. The next major HMG release (HMG 4.0) will be based on HMG OJECTS + HBQT so it will be:

a. Full standard OOP.
b. Full compatible with HMG semi-OOP style.
c. Multi-platform

3. I'll still work on HMG 3.0 to do maintenance (bug-fixing only).

4. After the base development in the HMG 4 release be complete, I'll create a team (If there are volunteers) to finish the work.

IMHO, the team work will be successful since:

a. HMG windows and controls properties events and methods (our project goals) are fully docummented.
b. QT classes are fully docummented.
c. QT is extremely high-level compared to Windows API.
d. QT classes has .prg level wrappers (HBQT) so, no C programming is required.
e. QT provides advanced functionality (ie: Inputmask for textbox is built in).
f. So, it's only matter of plug the adequate components in the right places :)

5. If we are successful, HMG 4 will be YOUR project.

6. Since I have a lot to learn and research yet (added to my others occupations) as I've already announced, I'll reduce my participation in the forum for some time (please don't worry :) ).

7. Hopefully, for HMG 10th birthday, I'll be another user/contributor :)

_________________
Regards/Saludos,

Roberto

Thursday, August 26, 2010

Latest HMG 3.0.35 Released in June 2010

CCH : Just switched to a new XP-based Notebook and decided to download the latest version of the HMG and will be testing whether a HMG-based exe can still be compiled :-)

 

HMG 3.0.35 (TEST)

File Name: hmg.3.0.35.exe
File Size: 24.73 MB
Date: 20. June 2010
Description:


- HMG 3.0.35 Changelog:

- Fixed: Multiselect listbox problems setting value property. Fixed by
Grigory Filatov.

- Fixed: Tab control: setting row and col properties when the tab has a
child panel window.

- Fixed: Conflict between Harbour and hmg charxor functions. Fixed by
Esgici.

- Fixed: Problem with 'Visible' property. Previous version forced
message processing creating problems in some rare situations.

- Fixed: Problem in IDE closing object ispector or project manager
with alt+F4.

Friday, October 16, 2009

HMG Version 3.0 ... on the way

CCH : Looks as if the HMG Version 3.0 is on the way :-)

HMG 3.0.0 (Test V) Changelog:

English:
--------

- Updated: Harbour compiler to 2.0 (Created from SVN 2009.10.14).
HMG IDE 2.9.4 and earlier versions ARE NOT COMPATIBLE with this
HMG version.

- Updated: MingW compiler to 4.4.1

- Modified: Samples.

Removed: ADORDD samples (adordd not working on
current Harbour release)

Added: RDDSQL samples.

-\HMG\SAMPLES\RDD.SQL\MYSQL
-\HMG\SAMPLES\RDD.SQL\ODBC
-\HMG\SAMPLES\RDD.SQL\ARRAY
-\HMG\SAMPLES\MEMORY.TABLES
-\HMG\SAMPLES\MULTI.WIN

New: 'Build.bat' (it replaces 'compile.bat').

Build [/i|/r|/d|/cs|/ci/cr] | [config.hbc]

[/i] : incremental build
[/r] : incremental build (rebuild all)

[/cs] : Console/mixed mode (std build)
[/ci] : Console/mixed mode (incremental build)
[/cr] : Console/mixed mode (incremental rebuild all)

[/d] : Debug mode (gui and console)

: A text file with .hbp extension containing a source list
: A text file with configuration parameters as additional
libs, include paths and lib paths.

Syntax:

incpaths = incpath1 incpath2 ... incpathn

libpaths = libpath1 libpath2 ... libpathn

libs = lib1 lib2 ... libn

library names must not include 'lib' prefix nor '.a' extension.

Sample: \HMG\SAMPLES\MULTI.PRG


More at http://hmgforum.com

Tuesday, October 6, 2009

Why does HMG use a customised version of Harbour ?

CCH : From the Harbour Main Developers List

Date: Mon, 05 Oct 2009 13:56:26 -0300
From: Roberto Lopez <roberbox@gmail.com>
Subject: Re: [Harbour] Wich is the official harbour's user group?

Massimo Belgrano wrote:

 > Please Roberto lopez when you see this messages post your right reply
 >
 > Will harbour and hmg share an harbour corner to made assistance to
 > either final user?
 >

At first, regarding the name:

When I've created the library, It was only a simple experiment about
Harbour-C interface, so, I've not care about the name so much :)

I've picked "MiniGUI" because the library featured only a minimal
functionality/GUI object set, so, it appeared to be a good choice.

Some time later, I've realized that a Linux product existed with the
same name, so I've decided to add 'Harbour' to the name.

 From that time, the library was called 'Harbour MiniGUI'. So, avoiding
the name conflict and also made clear my compiler preferece.

There was another problem to solve, I had LOTS of support requests
regarding issues about Harbour and C compiler installation/compatibility.

Then I've decided to package all needed things ready to use with zero
configuration (this was possible with the great help of Lorenzo Fiorini
on MingW compatibility issues).

 From the first 'ready to use' distribution (MiniGUI library + MingW +
Harbour) I've decided to use an alternate name: "HMG". Of course, it
stands for *H*arbour *M*ini *G*ui (indeed, "Harbour MiniGUI" is a not
good one name at all :) )

Regarding the HMG Forum, Viktor is rigth about that the Harbour version
bundled with HMG is a customized version. Moreover, the customization is
minimal (contrib library names are not changed).

Moreover, there is certainly a lack of 'official' Harbour support to users.

Across years I've received tons of bugs reports about Harbour, that I
can't handle because lack of time or knowledge (mostly about
rdd/database issues).

Harbour official users lists is usually inactive, then, some users come
here (not the right place, of course).

HMG Forum site owner and admin is Rathinagiri (a long time HMG user and
contributor) so, he is the right person to ask about this.

 From my part (I've not followed the complete thread about this) there
is no problem to add a specific area on the forum to give support to
Harbour compiler specific issues, but, of course, we will need the
collaboration of some of the Harbour 'masters' to succeed.

 From about one year ago, HMG includes Harbour 1.01 and MingW 3.4.5, so
most questions will surely related to that combo (I'm waiting for
Harbour 2.0 final to replace 1.01 and MingW with 4.x).


Regards,

Roberto.
5th October 2009

Updated on 7th October 2009

Date: Tue, 06 Oct 2009 15:04:50 -0300
From: Roberto Lopez <roberbox@gmail.com>
Subject: Re: [Harbour] Wich is the official harbour's user group?

Viktor Szakáts wrote:

> [ Still not all though, as there exists another package called
> MiniGUI Extended, which actually ships with Harbour 2.0.0b2,

There was only one project from 2002 to 2005 (the one I've started) from
then, two forks emerged: "HMG extended" and "OOHG" (I'm only responsible
for "HMG").

> It's really your project and your decision, but IMO it'd be a big
> step if you'd use a vanilla Harbour build (without customization).
> This way it'd be easier to swap components and general Harbour support
> could be given for both bundled and standalone Harbour distros without
> first identifying which build is in question. Moreover, general
> Harbour support could be given at any forums without being concerned
> about where this build comes from. Same goes for MiniGUI: Support
> could be given even here or other official or unofficial Harbour
> forums.

It's a good idea.

The current HMG distribution uses Harbour 1.01 for MingW build
downloaded from Sourceforge. I've removed 'binutils' not required by HMG
and (of course) added libraries and other things, but this shoud be not
  create problems regarding Harbour compiler support.

Moreover, I'll begin experimenting with Harbour 2.0 beta and publish a
test HMG release ASAP.

If something goes wrong, I'll seek for help here, prior to attempt a
dirty hack, I promise :)

So, hopefully, we will have full 'Harbour support compatible' HMG releases.


Regards,

Roberto
 

Thursday, June 11, 2009

HMG : Latest Version 2.92 by Roberto Lopez

CCH: From the HMG Forum

HMG 2.9.2
- Fixed: Print Preview. 'go to page' window not refresh preview window.

- Modified: Documentation completed, fixed, indexed, linked and formatted.

- New: Property style synonyms for the following GUI
objects (look at documentation for details):

- WINDOW
- TOOLBAR
- TREE
- TAB
- SPLITBOX
- CONTEXT MENU
- DROPDOWN MENU
- MAIN MENU
- STATUSBAR

The following synonyms for alternate syntax were added:

- LINES (NOLINES)
- ALIGNMENT (CENTERALIGN,RIGHTALIGN)
- TODAY (NOTODAY)
- TODAYCIRCLE (NOTODAYCIRCLE)
- DATATYPE (NUMERIC,CHARACTER,DATE)
- CASECONVERT (UPPERCASE,LOWERCASE)
- TICKMARKS (NOTICKS)
- AUTOSIZEWINDOW (NOAUTOSIZEWINDOW)
- AUTOSIZEMOVIE (NOAUTOSIZEMOVIE)
- ERRORDLG (NOERRORDLG)
- MENU (NOMENU)
- OPEN (NOOPEN)
- PLAYBAR (NOPLAYBAR)


Download: http://sourceforge.net/projects/harbourminigui/


Regards,

Roberto.

Sunday, May 17, 2009

Exporting DBF to MySQL

CCH : Have you ever wondered whether we can export our DBFs to MySQL ?
Well Sudip with the help of Rathinagiri (owner of HMG Forum) came out with this working version of DBF2MYSQL using Harbour+HMG as built by HMG IDE. BTW, this working prg also clearly demonstrates how we can connect to MySQL via Harbor + HMG.

BTW, the original codes for connecting to MySQL may have come from Mitja Podgornik





#Include "MiniGui.ch"
#include "DbStruct.ch"


Procedure Main()
Private Dbo := Nil
Private cHostName:= "localhost"
Private cUser:= "root"
Private cPassWord:= ""
Private cDatabase:= ""
Private cDbf:= ""
Private cTable:= ""
Private lOpened := .f.
Private lLogin:= .F.

DEFINE WINDOW frmMain ;
AT 5,5 ;
WIDTH 640 ;
HEIGHT 480;
TITLE "DBF To 'New' MySql Table (Created with help from Rathinagiri)" ;
MAIN ;
NOSIZE ;
ON INIT MySQL_Login() ;
ON RELEASE MySQL_Logout()


@ 30, 30 label lblDatabase value "Database:" ;
width 100
@ 30, 100 textbox txtDatabase ;
width 150

@ 30, 300 listbox lstDatabase width 200 height 200 ;
on dblclick { frmMain.txtDatabase.value := frmMain.lstDatabase.item(frmMain.lstDatabase.value)}


@ 200, 100 button cmdSelectDbf caption "Select &Dbf" width 150 ;
on click SelectDbf()

@ 240, 100 label lblDbf value "" width 150

@ 280, 100 button cmdExport caption "&Export to MySql" width 150 ;
on click ExportToMySql()

@ 350, 100 PROGRESSBAR pgbExport ;
VALUE 0 ;
RANGE 0 , 100 ;
WIDTH 300 ;
HEIGHT 26 ;


DEFINE STATUSBAR
STATUSITEM " "
END STATUSBAR

DEFINE MAIN MENU
POPUP "&File"
Item "E&xit" action thiswindow.release()
end popup
END MENU

END WINDOW

frmMain.pgbExport.visible := .f.
CENTER WINDOW frmMain
ACTIVATE WINDOW frmMain

Return Nil



static function MySql_login()
DEFINE WINDOW frmLogon ;
AT 0,0 ;
WIDTH 280 HEIGHT 190 ;
TITLE 'Login MySql' ;
MODAL ;
NOSYSMENU

@ 20,30 LABEL lblHostName ;
VALUE "HostName/IP" ;
WIDTH 150 ;
HEIGHT 35

@ 20,120 TEXTBOX txtHostName ;
HEIGHT 25 ;
VALUE cHostName ;
WIDTH 120 ;
ON ENTER iif( !Empty(frmLogon.txtHostName.Value), frmLogon.txtUser.SetFocus, frmLogon.txtHostName.SetFocus )

@ 50,30 LABEL lblUser ;
VALUE "User" ;
WIDTH 120 ;
HEIGHT 35

@ 50,120 TEXTBOX txtUser ;
HEIGHT 25 ;
VALUE cUser ;
WIDTH 120 ;
ON ENTER iif( !Empty(frmLogon.txtUser.Value), frmLogon.txtPassword.SetFocus, frmLogon.txtuser.SetFocus )

@ 80,30 LABEL lblPassword ;
VALUE "Password" ;
WIDTH 120 ;
HEIGHT 35

@ 80,120 TEXTBOX txtPassword ;
VALUE cPassWord ;
PASSWORD ;
ON ENTER frmLogon.cmdLogin.SetFocus

@ 120,30 BUTTON cmdLogin ;
CAPTION '&Login' ;
ACTION SQL_Connect()

@ 120,143 BUTTON cmdLogoff ;
CAPTION '&Cancel' ;
ACTION frmMain.Release

END WINDOW

CENTER WINDOW frmLogon
ACTIVATE WINDOW frmLogon

Return Nil






Function SQL_Connect()
cHostName:= AllTrim( frmLogon.txtHostName.Value )
cUser:= AllTrim( frmLogon.txtUser.Value )
cPassWord:= AllTrim( frmLogon.txtpassword.Value )

Dbo := TMySQLServer():New(cHostName, cUser, cPassWord )
If Dbo:NetErr()
MsGInfo("Error connecting to SQL server: " + Dbo:Error() )
Release Window ALL
Quit
Endif
lLogin := .T.
frmLogon.Release
frmMain.StatusBar.Item(1) := "MySql Server Connected!!!"

frmMain.lstDatabase.DeleteAllItems()
AEVAL( dbo:ListDbs(), { | a | frmMain.lstDatabase.AddItem( a ) } )

Return Nil




Function SelectDbf()
cDbf := alltrim(GetFile({{"DBF Files","*.dbf"}},"Select a dbf file",,.f.,.f.))
frmMain.lblDbf.caption := cDbf
if len(alltrim(cDbf)) > 0
if file(cDbf)
use &cDbf
lOpened := .t.
endif
endif
RETURN NIL



Function ExportToMySql()
local aStruct := {}, cSql, i, mFldNm, mFldtype, mFldLen, mFldDec, mSql

cDatabase := frmMain.txtDatabase.value
if empty(cDatabase)
MsgInfo("Please specify Database name")
frmMain.txtDatabase.setfocus
return nil
endif

if !DbExist(dbo, cDatabase)
if !miscsql(dbo, "CREATE DATABASE "+cDatabase)
return nil
endif
endif

if !miscsql(dbo, "USE "+cDatabase)
return nil
endif

if empty(cDbf)
MsgInfo("Please select a Dbf table")
frmMain.cmdSelectDbf.setfocus
return nil
endif

cTable := ALLTRIM(substr(cDbf,Rat('\',cDbf)+1))
cTable :=substr(cTable,1,len(cTable)-4)

select &cTable
aStruct = DbStruct()

mSql := "CREATE TABLE IF NOT EXISTS "+cTable+" ("

for i := 1 to len(aStruct)
mFldNm := aStruct[i, DBS_NAME]
mFldType := aStruct[i, DBS_TYPE]
mFldLen := aStruct[i, DBS_LEN]
mFldDec := aStruct[i, DBS_DEC]

if i > 1
mSql += ", "
endif
mSql += alltrim(mFldnm)+" "

do case
case mFldType = "C"
mSql += "CHAR("+LTRIM(STR(mFldLen))+")"
case mFldType = "D"
mSql += "DATE"
case mFldType = "T"
mSql += "DATETIME"
case mFldType = "N"
mSql += "DECIMAL("+LTRIM(STR(mFldLen))+", "+LTRIM(STR(mFldDec))+")"
case mFldType = "F"
mSql += "FLOAT"
case mFldType = "I"
mSql += "INTEGER"
case mFldType = "B"
mSql += "DOUBLE"
case mFldType = "Y"
mSql += "DECIMAL(20, 4)"
case mFldType = "L"
mSql += "SMALLINT(1)"
case mFldType = "M"
mSql += "TEXT"
case mFldType = "G"
mSql += "BLOB"
otherwise
msginfo("Invalid Field Type: "+mFldType)
return nil
endcase
next

mSql += ")"

//msginfo(mSql)

if !miscsql(dbo, mSql)
return nil
endif

frmMain.pgbExport.value := 0
frmMain.pgbExport.visible := .t.
select &cTable
go top
do while !eof()
do events
frmMain.pgbExport.value := recno()/reccount()*100

mSql := "INSERT INTO "+cTable+" VALUES ("

for i := 1 to len(aStruct)
mFldNm := aStruct[i, DBS_NAME]

if i > 1
mSql += ", "
endif

mSql += c2sql(&mFldNm)
next

mSql += ")"

if !miscsql(dbo, mSql)
msgbox("Problem in Query: "+mSql)
return nil
endif

select &cTable
skip
enddo
frmMain.pgbExport.value := 0
frmMain.pgbExport.visible := .f.

return nil










Function MySQL_Logout()
if Dbo != Nil
Dbo:Destroy()
Dbo := Nil
EndIf
Return Nil



Function MySQL_Connect()
If Dbo != Nil
Return Nil
Endif
Dbo := TMySQLServer():New(cHostName, cUser, cPassWord )
If Dbo:NetErr()
MsGInfo("Error connecting to SQL server: " + Dbo:Error() )
Release Window ALL
Quit
Endif
return nil



Function DbExist(dbo, cDatabase)
local aDbList := {}
cDatabase := lower(cDatabase)
aDbList := dbo:ListDbs()
if dbo:neterr()
msginfo("Error in varifying database list: "+dbo:error())
return .f.
endif
return (ascan(aDbList, {|x| lower(x) == lower(cDatabase)}) > 0)



Function TableExist(dbo, cTable)
local aTableList := {}
cTable = lower(cTable)
aTableList := dbo:ListTables()
if dbo:neterr()
msginfo("Error in varifying table list: "+dbo:error())
return .f.
endif
return (ascan(aTableList, {|x| lower(x) == lower(cTable)}) > 0)



//dbo is a public variable holding the database object
FUNCTION connect2db(host,user,password,dbname)
dbo := tmysqlserver():new(AllTrim(host),AllTrim(user),AllTrim(password))
IF dbo:NetErr()
msginfo(dbo:ERROR())
RETURN .f.
ENDIF
dbo:selectdb(dbname)
IF dbo:NetErr()
msginfo(dbo:ERROR())
RETURN .f.
ENDIF
//msginfo("Successfully Connected to the MySQL Server")
RETURN .t.



function sql(dbo1,qstr)
local i, j
local table := nil
local currow := nil
local tablearr := {}
local rowarr := {}
local curdateformat := set(_SET_DATEFORMAT)
set date ansi
table := dbo1:query(qstr)
set(_SET_DATEFORMAT,curdateformat)
if table:neterr()
msgstop(table:error())
table:destroy()
return tablearr
else
if table:lastrec() > 0
asize(tablearr,0)
for i := 1 to table:lastrec()
asize(rowarr,0)
currow := table:getrow(i)
for j := 1 to table:fcount()
aadd(rowarr,currow:fieldget(j))
next j
aadd(tablearr,aclone(rowarr))
next i
endif
table:destroy()
return tablearr
endif
return tablearr



function miscsql(dbo,qstr)
local curdateformat := set( _SET_DATEFORMAT)
set date ansi
table := dbo:query(qstr)
set( _SET_DATEFORMAT,curdateformat)
if table:NetErr()
msgstop(table:ERROR())
table:destroy()
return .f.
endif
table:destroy()
return .t.



function C2SQL(Value)

local cValue := ""
local cFormatoDaData := set(4)
do case
case Valtype(Value) == "N"
cValue := AllTrim(Str(Value))

case Valtype(Value) == "D"
if !empty(Value)
cValue := "'"+DTOS(value)+"'"
else
cValue := "'00000000'"
endif
case Valtype(Value) $ "CM"
IF Empty( Value)
cValue="''"
ELSE
cValue := "'"
Value:=DATATOSQL(value)
cValue+= value+ "'"
ENDIF

case Valtype(Value) == "L"
cValue := AllTrim(Str(iif(Value == .F., 0, 1)))

otherwise
cValue := "''" // NOTE: Here we lose values we cannot convert

endcase

return cValue


/*
So, our insert query may be like this.
qsuccess := miscsql(dbo,"insert into table1 (name, address1,city) values ("+c2sql(form1.name1.value)+","+c2sql(form1.address1.value)+","+c2sql(form1.city.value)+")")
*/


/*
Select query may be like this.
tablearray := sql(dbo,"select * from table1 where city = "+c2sql(form1.city.value))
*/

Monday, May 11, 2009

HMG Coding Tips by Esgici

CCH: The following are useful tips by Esgici of the HMG Forum in response to one of my posts.

By Esgici - 10th May 2009

For any code BEFORE defining Main Form must don't include any GUI control.

In summary :

- Every HMG appl must one only one Main Window

- The message functions ( MsgXXXX() ) are only exceptions of this rule, as explained in one of HMG Help topics .

- Since the message functions are special cases, there isn't any way to add another control such as Progress Bar. A messages window with such control may be only an user defined form or control and so must depend to main form ( by a direct or indirect way )

- Code placed BEFORE defining and activating Main Form must don't have any GUI control.

- Code between DEFINE WINDOW and END WINDOW are definitions statement only.

- Form and controls included in a form will be realized by ACTIVATE command, not when defined.

- ON INIT is a event definition and will be fired first when ACTIVATE command executed. So you can reference a control defined in this window in a ON INIT procedure / function / code block.

As far as know there isn't any special case when an appl launched by another one ( except any communication betwwen them ). An appl work rightly stand alone must also work by calling another one.

Sunday, May 3, 2009

Reporting with HMG : Part II

In the previous article Reporting with HMG : Part I, I had shown you how easy it was to code a report using HMG's DO REPORT command.

But what should you do if you have the need to customise your standard application reports for different customers and yet maintain only one executable ?

In this respect, HMG allows you to define and even edit a report format using any text editor (including Notepad) and then print within your Harbour+HMG application without recompiling.

Here is how to achieve the above :-

#include 'minigui.ch'

procedure main()
//
define window MainForm ;
at 0,0 ;
width 100;
height 100 ;
title 'FAS4HMG' ;
main

DEFINE MAIN MENU
POPUP 'File'
ITEM 'Print GL Chart of Accounts ' ACTION PrintExternalGlChart()
END POPUP
END MENU
end window
//
activate window MainForm

Return Nil

function PrintExternalGlChart()
cClient:='Clipper... Clipper... Clipper'
use GLAC
index on glcode to printexternalglchart
go top
DO REPORT FORM GlChart
use
return


GlChart.rpt

DEFINE REPORT TEMPLATE
TITLE 'GL Chart of Accounts|' + cClient
HEADERS {'',' ',' ',' '} , {'GL CODE','GL NAME','GL GROUP','GL TYPE'}
FIELDS {'glcode','glname','glgroup','gltype'}
WIDTHS {10,40,20,10}
TOTALS {.F.,.F.,.F.,.F.}
NFORMATS { , , ,}
WORKAREA glac
LPP 50
CPL 80
LMARGIN 4
PREVIEW
SELECT
IMAGE {'client.jpg', 0,1,1,1 }
GROUPED BY 'GLGROUP'
HEADRGRP 'GL Group:'
END REPORT



More to come..

Reporting with HMG : Part I

It is amazingly easy to create and print reports using HMG...

All you have to do is as follows :-

#include 'minigui.ch'

procedure main()
//
define window MainForm ;
at 0,0 ;
width 100;
height 100 ;
title 'FAS4HMG' ;
main

DEFINE MAIN MENU
POPUP 'File'
ITEM 'Print GL Chart of Accounts ' ACTION PrintGLChart()
END POPUP
END MENU
end window
//
activate window MainForm

Return Nil



function PrintGLChart()
//
use GLAC
index on glcode to printglchart
//
set date british
set century on
//
DO REPORT ;
TITLE 'GL Chart of Accounts' ;
HEADERS {'','','',''} , {'GL CODE','DESCRIPTION','GL GROUP','GL TYPE'} ;
FIELDS {'glcode','glname','glgroup','gltype'} ;
WIDTHS {10,40,20,10} ;
TOTALS {.F.,.F.,.F.,.F.} ;
NFORMATS {'','','',"} ;
WORKAREA GLAC ;
LPP 50 ;
CPL 80 ;
LMARGIN 2 ;
PAPERSIZE DMPAPER_A4 ;
PREVIEW ;
SELECT ;
MULTIPLE ;
GROUPED BY 'glgroup' ;
HEADRGRP 'GL Group'
//

Return Nil


After Clicking Yes


After Choosing Thumbnails



If the above-mentioned codes are recompiled with MiniGui ie HMG Extended




Next : Reporting with HMG : Part II

Saturday, March 21, 2009

HMG: Grid versus Browse [Updated 25th March 2009]

CCH :
According to the MiniGUI Help File, a Browse control is a general purpose database browser.
while a control Grid is a container object that displays data in rows and columns, and is similar in appearance to a Browse window.

Q1. So, what are the differences ?

Q2. When to use BROWSE ?

Q3. When to use GRID ?

Sudip :

Q4. For browse control (for data editing), do we need to use table "EXCLUSIVELY" ?


Answers

1. Rathinagiri (HMG Forum) :

1.1 Browse controls are always linked with one table (that too a .dbf table).

1.2 Grid controls are for used for other purposes where, you wish to represent data in row,col format. For example, it may show a two dimensional array!

1.3 All the browse controls are grid controls but not vice versa.

2. MOL aka Malek, Poland (HMG Forum)

2.1 I think you will have problems with browsing huge tables (exhausting memory, etc) while using grid. Using Browse, I didn't found problems with database which has 100MB.

2.2 You need to open table in exclusive mode only when you want to add records or edit record via ALT-A, ALT-E.

2.3 If you open table in shared mode, you must write your own function to add, edit or delete rows.

2.4 WORKAREA property of Browse is available at control definition only.


3. Sudip, Kolkata, West Bengal India

3. 1 I just found a big difference in Grid and Browse in MiniGUI extended!
If you use SET AUTOADJUST ON. Then Grid will be auto adjusted, but normal Browse (not tsbrowse) will not! :)

3.2 As per help file (hmg_hlp.chm), we can set WORKAREA during definition of browse only! Cannot change on the fly!

3. Bicahi Esgici, HMG Forum, Turkey

Hi to all Clipper and especially HMG fans

I want give a humble answer to an unanswered question in Saturday, March 21, 2009 post HMG; Grid versus Browse;

Sudip ;

Q4. For browse control (for data editing), do we need to use table "EXCLUSIVELY" ?

A4. No. If your application will run in a single machine this doesn’t matter. In a network environment you can’t open your files exclusively. If so, only one user (who come first) can use your application. Than, you MUST use SHARED mode. BTW you don’t need specify SHARED mode option every open (USE); setting globally EXCLUSIVE OFF is sufficient.

When a file open by shared, editing need some considerations. Under Browse or not, you have LOCK every record before and UNLOCK after edit ( changing record pointer also issue an UNLOCK). LOCK ( .T.) property of BROWSE successfully achieve this duty for you.

While a BROWSE active, ALT-A allow row appending to table. This is only issued an APPEND BLANK command. This command automatically LOCK new appended (empty) record. So, doesn’t require any precaution.

Precaution required for operations intended multiple records, such as PACK, ZAP, APPEND FROM, DELETE FOR ... / ALL, RECALL FOR ... / ALL, REPLACE FOR ... / ALL, UPDATE ON ...

The best way for such operations is "close" application to network ( all user ) and performing on a single machine. Another way is using FLOCK() for a limited time.

I hope that this answer will be useful.

Regards and happy HMG’ing

Tuesday, March 17, 2009

Mel Smith : From CA-Clipper to xHarbour+HMG

CCH: On reading a email from Sudip regarding Mel Smith's migration from CA-Clipper to xHarbourt+HMG, I wrote to Mel Smith on 16th March 2009 and obtained his consent to republish it here.

Mel Smith to Sudip

Sudip,

Many people are starting to use the 'IDE' method (and, apparently successfully).

However, I am 'old-fashioned' and so I hand-code everything, and I use the 'HBMAKE.EXE' utility of xHarbour to build my apps.

If you provide me with an email address that allows attachments (btw, Gmail does *not* allow attachments), I will forward my BLD.BAT file, my xxx.BC file that is a parameter to HBMAKE, and my main app plus one other module for you to see how I proceed.

My conversion procedure is usually:

1. Make a copy of the original Clipper 5.2e program and all its various modules
2. Convert this copy to proper xHarbour (fixing all previous bad styles to proper styling, etc, etc)
3. With all modules converted to xHarbour, run this console-style program to ensure it works as good or better than the Clipper app
4. Start windowizing:
a. Start with the Function Main() and build a main window.
b. Add the main menu to this window
c. In one of the menu options, call/activate a simple sub-function (e.g., build all indexes)
d. Go to this sub function and add a child window and carry on with the conversion.
e. Go to c. again :)))

I have included the Main Window definition from the Main Function from one of my apps below:


... there are 1480 lines of setup before the following initialization of the app's Main Window ...

BTW, I had an old app named ACT (for Accounting -- I always use 3 letters for my various apps)
When I started converting to 'windows' I just added a 'W' to the beginning of 'ACT' . Thus, WACT is the app name
Please don't assume the code below is 'Good' or 'Sophisticated'. It is *not* ! It is just *my* conversion of old stuff. But it does work., and it is quite simple. There are about 48 separated modules I had to convert. The fragment below is part of the Main module

You will note that some of the conversion has not been required or completed yet (i.e., the donothing() function refers to this

...
...
SET MULTIPLE OFF

SET NAVIGATION EXTENDED
cWIN := "WACT"

DEFINE WINDOW WACT ;
AT nMTOP,nMLEFT ;
WIDTH nMWIDTH HEIGHT nMHEIGHT ;
TITLE "Accounting Control for A/P, A/R and Payroll: " + GVERSION + ;
" ( on Drive " + GNETDRV+" )" + " Process Date : " + GTHEN ;
ICON "WORLD" ;
FONT "Arial" SIZE 12 ;
MAIN ;
ON INIT {|| (IIF(lRBLDIDX,(WACT.LABNDX.SHOW,WACT.NDXFIL.SHOW, ;
WACT.INDEXPROG.SHOW,RBLDIDX(lSETUPDBF:=.T.)),), ;
WACT.LABNDX.HIDE,WACT.NDXFIL.HIDE,WACT.INDEXPROG.HIDE, ;
(GABORT := .NOT. SETUPDATES(GDATE), ;
IIF(GABORT,DOMETHOD("WACT","RELEASE"),.T.)), ;
SETSTATUS(cWINSTATUS:=" Ready for Menu Selection"))}

DEFINE MAIN MENU
POPUP "Accounts &Payable"
ITEM " 1. Add/Edit A/P Transactions" ACTION {||MNTPAY(),DBCLOSEALL()}
ITEM " 2. Add/Edit C/R Transactions" ACTION DONOTHING() DISABLED
ITEM " 3. Load Suppliers" ACTION DONOTHING() DISABLED
ITEM " 4. Update Supplier A/P File" ACTION DONOTHING() DISABLED
ITEM " 5. Update Purchase Order File" ACTION {||MNTPCH(),DBCLOSEALL()}
ITEM " 6. Fix Vend Acct. Nos. in A/P" ACTION DONOTHING() DISABLED
ITEM " 7. P.O Report Menu" ACTION DONOTHING() DISABLED
ITEM " 8. A/P Reports / Cheques Menu" ACTION {||PAYREPS(),DBCLOSEALL()}
ITEM " 9. C/R Reports / Cheques Menu" ACTION DONOTHING() DISABLED
ITEM " A. Multi-Job Costing Tables" ACTION {|| LOADCOST("WACT"),DBCLOSEALL(), ;
SETPROPERTY("WACT","oSTOPSCAN","VISIBLE",.F.), ;
SETPROPERTY("WACT","oSTOPSCAN","ENABLED",.F.)}
ITEM " B. Job Costing for ONE Job" ACTION {||MNTJCS(),DBCLOSEALL()}
ITEM " X. Exit" ACTION DOMETHOD("WACT","Release")
END POPUP

POPUP "Accounts &Receivable"
ITEM " 1. Add/Edit A/R Transactions" ACTION DONOTHING() DISABLED
ITEM " 2. Fix Cust No. in A/R File " ACTION DONOTHING() DISABLED
ITEM " 3. Edit Customer Information" ACTION DONOTHING() DISABLED
ITEM " 4. Edit Customer Financials " ACTION DONOTHING() DISABLED
ITEM " 5. " ACTION DONOTHING() DISABLED
ITEM " 6. Receipts Input Processing" ACTION DONOTHING() DISABLED
ITEM " 7. " ACTION DONOTHING() DISABLED
ITEM " 8. Print Reports / Invoices " ACTION DONOTHING() DISABLED
ITEM " 9. " ACTION DONOTHING() DISABLED
ITEM " A. Change Txn Number Format " ACTION DONOTHING() DISABLED
ITEM " B. Import Spreadsheet Data " ACTION DONOTHING() DISABLED
END POPUP

POPUP "&Utilities"
ITEM " 1. View/Edit G/L Master " ACTION DONOTHING() DISABLED
ITEM " 2. View Admin Passwords " ACTION DONOTHING() DISABLED
ITEM " 3. Load C/R Register File" ACTION DONOTHING() DISABLED
ITEM " 4. Load G/L Accounts File" ACTION DONOTHING() DISABLED
ITEM " 5. Load Time-Sheet Files " ACTION DONOTHING() DISABLED
ITEM " 6. Load Employee File " ACTION DONOTHING() DISABLED
ITEM " 7. Re-Build Vendor Codes " ACTION DONOTHING() DISABLED
ITEM " 8. Set-Up P.O. Remarks " ACTION DONOTHING() DISABLED
ITEM " 9. Set-Up Div/EWO DBFs " ACTION DONOTHING() DISABLED
ITEM " A. Set-Up Work-Area DBFs " ACTION DONOTHING() DISABLED
END POPUP

POPUP "&Employees"
ITEM " 1. Browse Employee File " ACTION DONOTHING() DISABLED
ITEM " 2. Browse Job Desc File " ACTION DONOTHING() DISABLED
ITEM " 3. Browse Rates/Deductions " ACTION DONOTHING() DISABLED
ITEM " 4. Time-Sheet Entry System " ACTION {||MNTTBS(),DBCLOSEALL()}
ITEM " 5. Print Time and Expenses " ACTION {||TBSREPS(),DBCLOSEALL()}
ITEM " 6. Print Payroll Cheques " ACTION DONOTHING() DISABLED
ITEM " 7. Period-End Payroll " ACTION DONOTHING() DISABLED
ITEM " 8. Load Employees (AccPac) " ACTION DONOTHING() DISABLED
ITEM " 9. View TBS Time-Sheets " ACTION DONOTHING() DISABLED
ITEM " A. Browse Unions File " ACTION DONOTHING() DISABLED
END POPUP

POPUP "&Manager"
ITEM " 1. Rebuild Index Files" ACTION RBLDIDX(lSETUPDBF:=.T.)
ITEM " 2. Edit Company Information" ACTION {|| MNTSYS(),DBCLOSEALL()}
ITEM " 3. Run old DOS ACT System" ACTION DOOLDACT("WACT")
ITEM " 4. View / Edit Job Status" ACTION {|| MNTJOB("WACT"),DBCLOSEALL()}
ITEM " 5. View / Edit Job Rates" ACTION {|| MNTJRT(),DBCLOSEALL()}
ITEM " 6. Print Job(s) Status" ACTION DONOTHING() DISABLED
ITEM " 7. Test Send of Email" ACTION SENDMAIL()
ITEM " X. Exit" ACTION DOMETHOD("WACT","Release")
END POPUP

END MENU

@ (nMBOT-nMTOP)/2 - 40, 150 LABEL LABNDX AUTOSIZE ;
VALUE "Indexing File : " ;
INVISIBLE

cFIL2NDX := SPACE(20)

@ (nMBOT-nMTOP)/2 - 40, 300 TEXTBOX NDXFIL VALUE cFIL2NDX ;
WIDTH 300 ;
INVISIBLE

@ (nMBOT-nMTOP)/2,150 PROGRESSBAR INDEXPROG ;
RANGE 0,10000 ;
WIDTH 600 ;
HEIGHT 30 ;
SMOOTH ;
INVISIBLE ;
TOOLTIP "Indexing Progress"


@ nMBOT-86,000 LABEL STATPMPT OF WACT AUTOSIZE ;
VALUE "Status Line->" ;
FONT "Arial" SIZE 10

@ nMBOT-86,100 LABEL STATLINE OF WACT ;
VALUE cWINSTATUS ;
WIDTH 500 HEIGHT 30 ;
FONT "Arial" SIZE 10 ;
BOLD

@ nMCTRROW-(nBUTTH),nMCTRCOL-(nBUTTH) BUTTONEX oSTOPSCAN OF WACT;
CAPTION "Stop Scan"+CRLF+"of Job Cost"+CRLF+"Databases" ;
WIDTH nBUTTW+30 ;
HEIGHT nBUTTH+40 ;
FONTCOLOR RED ;
BACKCOLOR YELLOW ;
NOTABSTOP ;
BOLD ;
INVISIBLE ;
ACTION {||lESCPRESSED := .T.}

WACT.oSTOPSCAN.ENABLED := .F.
WACT.oSTOPSCAN.VISIBLE := .F.

ON KEY ESCAPE OF WACT ACTION {||nESCKEY:=K_ESC,THISWINDOW.RELEASE}

END WINDOW

Mel Smith

Friday, March 13, 2009

Mapping Clipper Command to HMG Commands

To assist CA-Clipper users to understand the Harbour MiniGUI (HMG) equivalent, I have listed the following examples :-

1. @... SAY

Clipper :

@row, col SAY [PICTURE ] [COLOR ]

Example :
@ 15, 20 SAY "Phone" PICTURE "@R (999)999-9999" COLOR "BG+/B+, BG+/N"

HMG :
@ , LABEL
[ ID ]
[ OF | PARENT | DIALOG ]
VALUE
[ ACTION | ONCLICK | ON CLICK | ]
[ WIDTH ]
[ HEIGHT ]
[ AUTOSIZE ]
[ FONT SIZE ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ TOOLTIP ]
[ BACKCOLOR ]
[ FONTCOLOR ]
[ BORDER ]
[ CLIENTEDGE ]
[ HSCROLL ]
[ VSCROLL ]
[ TRANSPARENT ]
[ RIGHTALIGN | CENTERALIGN ]
[ HELPID ]
[ INVISIBLE ]

Example
@ 15 ,20 LABEL Lbl_1;
VALUE "Phone" ;
WIDTH 350 HEIGHT 35 ;
FONT "Arial" SIZE 18 BOLD ;
FONTCOLOR BLUE ;
CENTERALIGN

CCH: Basically, SAY in Clipper becomes LABEL control. While COLOR string becomes BACKCOLOR & FONTCOLOR

2. @... GET
Clipper :

    @ , 
[SAY 
[PICTURE ]
[COLOR ]]
GET 
[PICTURE ]
[COLOR ]
[CAPTION]
[MESSAGE ]
[WHEN ]
[RANGE* , ] |
[VALID ]

HMG :
@ , GETBOX
[ ID ]
[ OF | PARENT | DIALOG ]
[ HEIGHT ]
[ WIDTH ]
[ FIELD ]
[ VALUE ]
[ PICTURE ] //** format function and template string
[ VALID | RANGE ,] // VALID - postvalidation function or codeblock which must return logical value
// RANGE - allowed range of values
[ VALIDMESSAGE ]
[ MESSAGE ] // text to display on STATUSBAR Item(1) when getbox have focus
[ WHEN ] // prevalidation function or codeblock (if return .f. GetBox is readonly
[ READONLY ]
[ FONT SIZE ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ PASSWORD ]
[ TOOLTIP ]
[ BACKCOLOR ] // * or
[ FONTCOLOR ] // * or
[ ON CHANGE ] ;
[ ON GOTFOCUS | ]
[ ON LOSTFOCUS | ]
[ RIGHTALIGN ]
[ INVISIBLE ]
[ NOTABSTOP ]
[ HELPID ]

Example :
@ 160,460 GETBOX GBox_1 ;
HEIGHT 24 WIDTH 120;
VALUE " " ;
FONT "Arial" SIZE 9 ;
ON CHANGE FindChg();
PICTURE '@XXXXXXXXXXXXXXXXXXXXXXX'

CCH: Basically, GET in Clipper becomes GETBOX control.

More GETBOX Examples

. @ 40,10 GETBOX Text_2 ;
HEIGHT 20;
VALUE 57639 ;
ACTION MsgInfo( "Button Action");
TOOLTIP "Numeric input. RANGE -100,200000 PICTURE @Z 99,999.99";
PICTURE '@Z 99,999.99';
RANGE -100,200000;
BOLD;
MESSAGE "Numeric input";
VALIDMESSAGE "Value between -100 and 200000 " ;
BACKCOLOR {{255,255,255},{255,255,200},{200,255,255}} ;
FONTCOLOR {{0,0,0},{255,255,200},{0,0,255}}

@ 78,10 GETBOX Text_3 ;
VALUE "Jacek";
ACTION MsgInfo( "Button Action");
ACTION2 MsgInfo( "Button2 Action");
IMAGE {"folder.bmp","info.bmp"};
BUTTONWIDTH 20 ;
PICTURE "@K !xxxxxxxxxxxxxx";
TOOLTIP "Character Input. VALID {|| ( len(alltrim(This.Value)) >= 2)} PICTURE @K !xxxxxxxxxxxxxx " ;
VALID {|| ( len(alltrim(This.Value)) >= 2)};
VALIDMESSAGE "Minimum 2 characters" ;
MESSAGE "Character Input";
BACKCOLOR {{255,255,255},{255,255,200},{200,255,255}} ;
FONTCOLOR {{0,0,0},{255,255,200},{0,0,255}}

@ 120,10 GETBOX Text_4 WIDTH 30 HEIGHT 20;
VALUE .t.;
TOOLTIP "Logical Input VALID {|| (This.Value == .t.)}";
PICTURE "Y";
VALID {|| (This.Value == .t.)};
VALIDMESSAGE "Only True is allowed here !!!";
MESSAGE "Logical Input";
BACKCOLOR {{255,255,255},{255,255,200},{200,255,255}} ;
FONTCOLOR {{0,0,0},{255,255,200},{0,0,255}}

@ 160,10 GETBOX Text_2a HEIGHT 20;
VALUE 234123.10 ;
TOOLTIP "Numeric input PICTURE @ECX) $**,***.**" ;
PICTURE '@ECX) $**,***.**' ;
BACKCOLOR {{255,255,255},{255,255,200},{200,255,255}} ;
FONTCOLOR {{0,0,0},{255,255,200},{0,0,255}}

@ 200,10 GETBOX Text_2b HEIGHT 20;
VALUE "Kowalski";
PICTURE "@K !!!!!!!!!!";
ON CHANGE {|| TONE(300)};
BACKCOLOR {{255,255,255},{255,255,200},{200,255,255}} ;
FONTCOLOR {{0,0,0},{255,255,200},{0,0,255}}

DEFINE GETBOX Text_2c // Alternate Syntax
ROW 240
COL 10
HEIGHT 20
VALUE "MyPass"
PICTURE "@K !!!!!!!!!"
BACKCOLOR {{255,255,255},{255,255,200},{200,255,255}}
FONTCOLOR {{0,0,0},{255,255,200},{0,0,255}}
VALID {|| ( len(alltrim(This.Value)) >= 4)}
TOOLTIP "Character input PASSWORD clause is set"
VALIDMESSAGE "Password must contains minimum 4 characters"
MESSAGE "Enter password (min 4 char.) "
PASSWORD .T.

Comments by Mel Smith from comp.lang.clipper/comp.lang.xharbour

David:

Here is a snippet of HMG Code that shows a prompt (P.O. Number:), then a
'GET' that inputs a P.O. number from the user, then verifies it and does a few more things.

These next two statements are 'inside' a Window Definition structure:

DEFINE WINDOW MNTPCH;
etc,
etc,

// This next is a 'SAY' emulation showing how wide/high the prompt
box should be,
// and where the label should be positioned (in 'pixels'), and that
// it should be right-aligned in its 'box'. Note that the 'LABEL'
has a name itself.
// Here, it is named LABPONUM, so that I can reference and change
the characteristics
// of the label itself at a later stsge -- if I wish to.

@ 010,010 LABEL LABPONUM OF MNTPCH WIDTH 090 HEIGHT 20 ;
VALUE "P.O. Number :" RIGHT

// This next is the 'GET' emulation showing the 'picture' clause,
the initial value to be displayed,
// the colors for foreground and background, and what to do when
gaining focus, and
// what to do when focus is lost, and then a Validation function to
perform on losing focus.

@ 010,120 GETBOX oPONUM OF MNTPCH WIDTH 060 HEIGHT 20 ;
PICTURE "@K! #####" ;
VALUE cPONUM ;
FONTCOLOR GFCOLORS ;
BACKCOLOR GBCOLORS ;
ON GOTFOCUS {|| IF(lGOTNEWPO,SETFOCUSTO("MNTPCH","oVENDCODE"), ;
SETPROPERTY("MNTPCH","LABF6SELPO","VISIBLE",.T.))}
;
ON LOSTFOCUS {||SETPROPERTY("MNTPCH","LABF6SELPO","VISIBLE",.F.)} ;
VALID {||GABORT := .NOT. CHKPONUM("MNTPCH","oPONUM",ALIAS(), ;
THIS.VALUE,@cPONUM),.T.} ;
TOOLTIP "Enter a different P.O. No., or use Movement Keys"

etc,
etc
// and many other fields, browses, etc, in here too
// It gets easier after you bang your head against the wall for five
months :))

END WINDOW

-Mel Smith, 14th March 2009

Sunday, March 8, 2009

Adding GUI to xHarbour/Harbour via HMG [Part II]

In my previous article on Adding GUI to xHarbour/Harbour via HMG [Part I], I have shown you that you can easily hand code, Windows Menu, ToolBar and StatusBar and the result is as below :-


Code Snippet
ToolBar
DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 25,25 FLAT BORDER
BUTTON Button_Exit ;
PICTURE 'exit.bmp' ;
TOOLTIP 'Exit this Application' ;
AUTOSIZE;
ACTION MsgInfo('Exit !');
SEPARATOR

BUTTON Button_ReindexAll ;
PICTURE 'task.bmp' ;
TOOLTIP 'Reindex All Files' ;
AUTOSIZE;
ACTION Reindex_All()

BUTTON Button_Calculator ;
PICTURE 'calculator.bmp' ;
TOOLTIP 'Windows Calculator' ;
AUTOSIZE;
ACTION ExecFile("C:\Windows\System32\calc.exe") ;
SEPARATOR
END TOOLBAR

Status Bar
DEFINE STATUSBAR
STATUSITEM "FAS4HMG" WIDTH 100
KEYBOARD
DATE
CLOCK
END STATUSBAR



Code Snippet
Menus
POPUP '&File'
POPUP '&Define Help Windows' name FileDefine
ITEM 'Define Fiscal Periods' ACTION EditExt('HLPFP')
ITEM 'Define Forex Table' ACTION EditHlpForex()
END POPUP
ITEM 'Exit' ACTION FileExit() IMAGE 'Exit.Bmp'

END POPUP

POPUP 'General Ledger'
ITEM '&Chart of Accounts' ACTION (BrowseGlac())
ITEM 'Report Writer' ACTION EditExt('REPTGL')
POPUP 'Standard Reports' name GLRept
ITEM 'Chart of Accounts' ACTION PrintViewChartofAccounts()
END POPUP
SEPARATOR

ITEM 'Reindex' ACTION Reind_GL()
ITEM 'Edit Fields Description' ACTION EditExt('GLDICT')
SEPARATOR
ITEM 'Rebuild GL' ACTION RebuildGL()
END POPUP


How about calling an external EXE ?

Code Snippet

EXECUTE FILE "C:\Windows\System32\calc.exe"

Using HMG's MsgYesNo() to replace Clipper Alert()

Code Snippet
if MsgYesNo('Reindex All Files ?','Confirm',{'Yes','No'})
ReindexAll()
endif

What about Reindexing with Progress Bar ?


What have I done to 'GUIFY ' FAS4XHB to FAS4HMG thus far ?

a) Completed Main Form Interface via MENU, TOOLBAR & STATUSBAR
Nb. With this, I got rid of the Clipper Menu Interface

b) Use EDIT/EDIT EXTENDED to replace my DBEDIT()-based data screens
Nb. With this, I got rid of the DBEDIT() Interface

c) Use PROGRESSBAR to allow reindexing with Progress Bar
Nb. Replaced my text-based Progress Bar

d) Use EXECUTE FILE 'KE.EXE' PARAMETERS
Nb. This means that I do not need to recode all my reports !

What resources have I used thus far ?

a) xHarbour compatible codes, see Migrating from 5.2e to xHarbour Part III

b) HMG distribution comprising Harbour+HMG, see What is HMG ?

d) HMGIDE, a 2-way IDE (only if you created forms from the IDE)

e) Speedy response by HMG Forum particularly Escigi, Rathinagiri, Grigory Filatov and not forgetting my newly-found friend Sudip
Bhattacharyya from Calcutta, West bengal , India :-)

Where do I go from Here ?

a) Master-Details Forms

b) Prettying up the Interface

Welcome to Clipper... Clipper... Clipper


In 1997, then using Delphi 3, I had already created 32-bits Windows applications for HRIS, ERP and CRM. In 2007, using Ruby on Rails, an AJAX powered CRM site running on Apache & MySQL was created and I am now using Visual Studio .Net 2008 to create web-based projects and Delphi 7 for Win32 applications using SQL2005 & DBFCDX.

So, why then am I reviving the Original Clipper... Clipper... Clipper via a Blog as CA-Clipper is a programming language for the DOS world ? Believe it or not, there are still some clients using my mission-critical CA-Clipper applications for DOS installed in the late 80's and up to the mid 90's. This is testimony to CA-Clipper's robustness as a language :-)

With the widespread introduction of Windows 7 64-bits as the standard O/S for new Windows based PCs & Notebooks, CA-Clipper EXE simply will not work and it has become imperative for Clipper programmers to migrate immediately to Harbour to build 32/64 bits EXEs

Since 28th January 2009, this blog has been read by 134,389 (10/3/11 - 39,277) unique visitors (of which 45,151 (10/3/11 - 13,929) are returning visitors) from 103 countries and 1,574 cities & towns in Europe (37; 764 cities), North America (3; 373 cities) , Central America & Caribeans (6; 13 cities), South America(10; 226 cities), Africa & Middle-East (12; 44 cities) , Asia-Pacific (21; 175 cities). So, obviously Clipper is Alive & Well : -)


TIA & Enjoy ! (10th October 2012, 11:05; 13th November 2015)


Original Welcome Page for Clipper... Clipper... Clipper

This is the original Welcome Page for Clipper... Clipper... Clipper, which I am republishing for historical and sentimental reasons. The only changes that I have made was to fix all the broken links. BTW, the counter from counter.digits.com is still working :-)

Welcome to Chee Chong Hwa's Malaysian WWW web site which is dedicated to Clipperheads throughout the world.

This site started out as a teeny-weeny section of Who the heck is Chee Chong Hwa ? and has graduated into a full blown web site of more than 140 pages (actually hundreds of A4 size pages) ! This is due to its growing popularity and tremendous encouragements from visiting Clipperheads from 100 countries worldwide, from North America, Central America, Caribbean, South America, Europe, Middle-East, Africa and Asia-Pacific. Thanx Clipperheads, you all made this happen !


What is Clipper ?

You may ask, what is this Clipper stuff ? Could Clipper be something to do with sailing as it is the name of a very fast sailing American ship in the 19th century ?

Well, Clipper or to be precise, CA-Clipper is the premier PC-Software development tool for DOS. It was first developed by Nantucket Corporation initially as a compiler for dBase3+ programs. Since then, CA-Clipper has evolved away from its x-base roots with the introduction of lexical scoping & pre-defined objects like TBrowse. As at today, the most stable version ofClipper is 5.2e while the latest version, 5.3a was introduced on 21 May 1996.

As at 11th November, 1996, an unofficial 5.3a fixes file was made available by Jo French. See the About CA-Clipper 5.3a section for more details. BTW, Jo French uploaded the revised 5.3a fixes file on 20th November, 1996.

Latest News

The latest news is that CA has finally released the long-awaited 5.3b patch on 21 May, 1997.

For 5.3b users, you must a take a look at Jo French's comments on unfixed bugs in 5.3b.

BTW, have you used Click ? If you're a serious Clipperprogrammer and need an excellent code formatter, Click is a natural choice. How to get it ? Simple, access Phil Barnett's site via my Cool Clipper Sites.

32-bits Clipper for Windows ?

Have you tried Xbase ++ ? Well, I have and compared to Delphi (my current Windows programming tool of choice), I'm still sticking to Delphi.

Anyway, you should visit the Alaska Home Page. Give it a chance and then draw your own conclusions !.

The Harbour Project

Is this the future of Xbase ? Take a look at at the Harbour Project

You are Visitor # ...

According to counter.digits.com, you are visitor since 3 June 1996.

If you like or dislike what you see on this website, please drop me a line by clicking the email button at the bottom of this page or better still, by filling out the form in my guest book. If you are not sure what to write,click here to take a look at what other Clipperheads have to say.