FMG2PRG
by Danny A. del Pilar
Manila, Philippines
dhaine_adp@yahoo.com
December 14, 2008
---------------------------------------------------------------------------------

WHAT IS FMG2PRG?

FMG2PRG is HMG source code converter. FMG2PRG coverts the forms (.fmg) generated by HMG IDE
into .prg source file.

This program is provided "AS IS" without warranty. 

HISTORY

FMG2PRG was my wife, Dorrie's, idea. Because I use to tell her that I like HMG because of its simplicity and it can run under linux. The problem is those long define statements that I have to translate manually to @ command syntax. So it's laborious most especially when it contains a complicated form. Her suggestion was, "if you can typed it manually perhaps you can make a converter that automates those things that you are supposed to typed".

Taking my wife's suggestion, sometime in September-October 2007, I began to wrote an experimental converter. And this is the product of that effort. 

I wish to share this little utility in the hope that it can also help you.

I created FMG2PRG as an ad hoc utility that I can used to shorten the coding time if I prefer to use the @ COMMAND syntax of the control objects of HMG. Furthermore, I don't have to memorize or cross referencing the HMG manual while doing the coding of the control objects. So I stick-on to a syntax that I can modify later on in the text editor. Although I tried to support the variation of the HMG control objects syntax but those variation is not tested thoroughly because my initial goal is to produce a working utility that I can used right away to help me code using the @ commands.

Well, anyway I use this tool extensively considering the fact that I have not yet achieved the perfection that I desired. For me, for the time being, the usefulness of the utility outweights the limiation and the bugs that comes along with it.

After I composed the UI (user interface) in HMG-IDE, I fire-up this tool and converts it into PRG source file.


LIMITATION:

As of the moment, this coverter works with HMG stable release. It also works with the latest release of HMG as long as the additional syntax is not used in the form definition in HMG-IDE. 

If you specify an action on the control objects there is a posibility that you would loose the action that you specify on the converted prg source file.

SUPPORTED HMG CONTROL OBJECTS:

ANIMATEBOX
BROWSE
BUTTON
CHECKBOX
COMBOBOX
DATEPICKER
EDITBOX
FRAME
GRID
HYPERLINK
IMAGE
IPADDRESS
LABEL
LISTBOX
PLAYER
PROGRESSBAR
RADIOGROUP
RICHEDITBOX
SLIDER
SPINNER
TEXTBOX


KNOWN BUGS:

1. When defining TEXTBOX control in HMG-IDE, make sure that MAXLENGTH is defined, otherwise
   the FMG2PRG "terminates with bound error array access". I am aware of this problem but
   I have no time to fix it as of the moment.

2. BUTTON controls produced an incorrect syntax when used with TEXT ONLY buttons. So
   during the definition in HMG-IDE at least enumerate a fictitious .BMP file in
   the picture properties of the BUTTON control object.

3. Well the golden rule, when you use the converter and it does not provide the proper
   syntax, then that's a BUG! or syntax error.

4. If the width and height of the objects is not coverted properly that means you have to
   load the form in HMG-IDE and look at it's properties and correct the converted
   source code.

I'm really sorry friends for the bugs, please bear with me. On the other hand, I'd still do have a plan of rewriting this utility again in different perspective which means a better parsing engine and to support future releases of HMG-IDE without much deliberation in code maintenance of the utility. But right now, I don't have much time to spend in revising this utility. Perhaps after I completed all those projects that I am working with on my spare time.

Your comments and suggestions are most welcome.

The syntax for @ commands is derived from the HMG manual.


PACKAGE CONTENTS:

FMG2PRG
   :----- BIN -----> contains the compiled binary of FMG2PRG
   :
   :----- SOURCE --> contains the source code of the FMG2PRG
   :
   :----- SAMPLE --> contains the source prg from TEST\frmMasterEntry.Fmg
   :                 The frmMasterEntry.prg is generated by FMG2PRG. It has been
   :                 modified using the POST CONVERSION TASK outlined below.
   :
   :----- TEST ----> contains frmMasterEntry.Fmg for testing or test it with your own .fmg
                     but make sure that you read the section "KNOWN BUGS".
                     SAMPLE and TEST folders are included for demonstration purposes only.


***********************************
* IMPORTANT: POST CONVERSION TASK *
***********************************

   After converting a .fmg file into .prg source file using FMG2PRG convertion utility you must perform the following three steps below:

1. Replace the form name from ~LDCS_Form with <form Name that you wish>.
   From your text editor do a search and replaced. (The character "~", tilde is used
   to prefix the form name to ensure that the global searched and replaced would
   only replaced the correct word phrase).

2. Replace the WIDTH, HEIGHT, TITLE, ICON found in DEFINE WINDOW STATEMENT with
   the correct values from DEFINE WINDOW TEMPLATE. The second task is also simple
   to do. The WIDTH and HEIGHT values is represented by letter "n". The ICON
   parameter is also designated with <Path>. (I intentionally leave it this way
   so that I can see the full syntax of define window statement without refering to the
   HMG manual. Although I should also strip this out but nevertheless I kept it as it
   is).

3. Delete the line DEFINE WINDOW TEMPLATE after you complete the second Step.

4. Proceed with your normal program coding task or

5. Test the converted prg source file using HMG-IDE as a new project and build it.
   Please delete the line that says #define "dale-aid.ch"


Thanks,


Danny


P.S.

I was a bit ashamed to post the program on it's current state but somehow I believed it can be of help.



