Prg2Fmg Project

Utilities like DBU, Make, IDE written in HMG/ used to create HMG based applications

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Prg2Fmg Project

Post by Pablo César »

Hi All,

As I promissed I got the first result for your appeciation.
At begining, as I said, there is only one LABEL in the form. Also the form is based as "MAIN" window. Probably to GetFormType will be not problem, but I also believe the most important is to interpret all controls and its properties which is being running at PRG and then to pass onto a FMG file. Normally is gonna take the same form name as FMG file name. But can be changed when exists the same fmg file.
Prg2Fmg is a basic code for at moment, some other controls must be added but I believe that LABEL funcion in it will helps for others controls as reference.

In attached file here are: Prg2Fmg.prg will be used as a library and Demo1.prg it would be considered your source code (PRG file where form is defined). Please note CopyToForm(<Form_Name>) is being called after the WINDOW declared in your PRG (before ACTIVE window).

I have two question at moment to be solved:

1. To find a better way to call this function for fmg be generated. :?
2. I'm foundin troubles to convert all ACTIONs (normally as CodeBlock) to string. Here's using hb_ValToExp() but its returns is always empty, not bringing the function declared for that action... :(

Added later (in red):
<Attached file was remove because there is a newer version ahead of this same topic>

How to test it?
You take HMG/IDE and open this Demo1 project and compile. When already runned out the executable, look at "Browser Project" at "Forms" tab and "Refresh Project Window" option at "Project" menu option of IDE. You will note Demo1.Fmg file already created. I should add a message displaying fmg file has been created.

I hope that you have reached the expectation about this project. Seems too easy, simple and I believe to be useful.

Please be free to make your constructive comments.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Prg2Fmg Project

Post by Pablo César »

Fixed some small bugs.

<Attached file was remove because there is a newer version ahead of this same topic>

And still looking for a solution of:

1. To find a better way to call this function for fmg be generated. :?
2. I'm founding troubles to convert all ACTIONs (normally as CodeBlock) to string. Here's using hb_ValToExp() but its returns is always empty, not bringing the function declared for that action... :(

For second item I've tried:

Code: Select all

// LOCAL cCtrlAction:=CharRem("{|}",_HMG_SYSDATA [ 6 ][nIndex])
// LOCAL cCtrlAction:=hb_ValToStr(_HMG_SYSDATA [ 6 ][nIndex])
/*
#Translate CBNew (<b>)      =>   \[ <b> \]
#Translate CBString (<b>)   =>   <b>\[2\]

cCtrlAction := CBString( cCtrlAction)
cCtrlAction := hb_CStr( CBString( cCtrlAction ) )
*/

// hb_MemoWrit("Label.txt",cCtrlAction)
// hb_MemoWrit("Label.txt",hb_valtoexp(cCtrlAction))
// SAVE TO LABEL ALL LIKE cCtrlAction*
cCtrlAction:=hb_ValToExp(_HMG_SYSDATA [ 6 ][nIndex])

/*
cTmp := "{|| cCtrlAction:=" + hb_valtoexp(cCtrlAction) + "}"
Save all Like cTMP* to MyMemFile

Restore from MyMemFile Additive
aA1:=Eval(&cTmp)
*/
And no success for second point... :roll:
Last edited by Pablo César on Thu Nov 03, 2016 4:21 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Prg2Fmg Project

Post by serge_girard »

Hi Pablo,

In my opinion the RTFM better takes care of 'visible' properties instead of <ActionProcedure> which are the domain of PRG itself. Don't you agree?

Serge
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Prg2Fmg Project

Post by Pablo César »

serge_girard wrote:Hi Pablo,

In my opinion the RTFM better takes care of 'visible' properties instead of <ActionProcedure> which are the domain of PRG itself. Don't you agree?

Serge
Thanks Serge, I will check in RTFM. Probably I will take use part of that...

Upto know I was with sort time to revise RTFM code.. :( But I will give a look it now.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Prg2Fmg Project

Post by Pablo César »

I am back... I have it the duly time for revising code in RTFM. It's different project than Prg2Fmg.

I do not know if you have understood details and main soul of Prg2Fmg. My propose with this last project is not to make any form designing change. What I am really want with Prg2Fmg is to bring FMG file when not exists or when FMG is not the same like as in PRG.

Sometimes many of us take the code of fmg in HMG/IDE from View menu option at "Form code" copy it (thru Ctrl C) and paste it at our PRGs. Sometimes we use to make changings at PRG too (in our source code) and the fmg becomes no updated.

In other cases, some of us, make handly our screens in pure code at prg (not using IDE).

In these cases when we need to change something (controls positions or any other properties) we found difficulties when we shall make in pure PRG.

In my privated opinion, I find easier the use of IDE at form designing. That's the really propose: to create fmg file according what is running at PRG. Do you got it?

As I said, RTFM could incorporate Prg2Fmg functions and vice versa. But I have started with different propose. Note that RTFM have not found the way yet for fmg writing...

Same difficult certainly will find vagblad and Nikos. Because if you have a form or a set of controls with its all properties (including ActionProcedures), all of these properties MUST be restored at the new form. Don't you agree with me?

So, in answer to your question:
Serge wrote:In my opinion the RTFM better takes care of 'visible' properties instead of <ActionProcedure> which are the domain of PRG itself. Don't you agree?
Sorry, but IMHO: no. Because we will need all the properties. Otherwise, fmg file will loose important information.

I am really frustrated for not getting the right way to transform CodeBlocks to String... but I will persisting, I am still alive... :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Prg2Fmg Project

Post by serge_girard »

Pablo,

For the RTFM project of Vagelis and Nikos it is better to only take care of 'visible' properties instead of <ActionProcedure>.

For your PRG2FMG I agree to have all properties because you want to create a totally new FMG file out of a PRG. Correct?

Serge
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Prg2Fmg Project

Post by Pablo César »

serge_girard wrote:Pablo,

For the RTFM project of Vagelis and Nikos it is better to only take care of 'visible' properties instead of <ActionProcedure>.

For your PRG2FMG I agree to have all properties because you want to create a totally new FMG file out of a PRG. Correct?

Serge
Sorry, but I gave already my opinion. :oops:
Pablo César wrote:Note that RTFM have not found the way yet for fmg writing...

Same difficult certainly will find vagblad and Nikos. Because if you have a form or a set of controls with its all properties (including ActionProcedures), all of these properties MUST be restored at the new form. Don't you agree with me?
But I don't think they want to write partially the fmg. Unless they can overwrite existing FMG file and be replaced only "the visible" properties. This I don't know. :?
But this discussion, certainly gave to them a good ideas. ;)

My concern is that everyone can understand the purpose of Prg2Fmg project. I am quite sure you have understood exactly what I want. :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Prg2Fmg Project

Post by Pablo César »

Giving sequence to my work in this project...

Now ready for Buttons (three types): Button, ImageButton and MixedButton. :D

This is a good chance to know HMG's controls deeply when you try to handle with it...

I found a litle bug in HMG/IDE when creates fmg with ImageButton. It creates with "Alignment Picture" always wrongly as "TOP" but _DefineImageButton function (HMG lib) correct this as always "CENTER".
If you create a button with image only, at IDE you will wrongly able to make choice (by ComboBox) at "PictAligment" property which IMO should be only one option: "CENTER" and there is not... :? Of course there is much things to do in IDE and this is small defect. It's just to FYI only.

I want also to let you know, this app (Prg2Fmg) take any "right" syntax from your executing code and transform as quite exactly as HMG/IDE creating of FMG file. If you are writting your code with Standard Syntax (xBase Style: @ ...) of controls: never mind because it will be always be created as Alternate Syntax (HMG pattern) as HMG/IDE be needed.

<Attached file was remove because there is a newer version ahead of this same topic>

I have included two new C functions for: ISFLAT and ISMULTILINE properties.
Last edited by Pablo César on Thu Nov 03, 2016 4:22 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Prg2Fmg Project

Post by srvet_claudio »

Pablo César wrote: I found a litle bug in HMG/IDE when creates fmg with ImageButton. It creates with "Alignment Picture" always wrongly as "TOP" but _DefineImageButton function (HMG lib) correct this as always "CENTER".
If you create a button with image only, at IDE you will wrongly able to make choice (by ComboBox) at "PictAligment" property which IMO should be only one option: "CENTER" and there is not... :?
Thanks for report.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Prg2Fmg Project

Post by Pablo César »

More one control: ListBox (both, unique and multiselect).

Added new C code ISSORTED()

<Attached file was remove because there is a newer version ahead of this same topic>
Last edited by Pablo César on Thu Nov 03, 2016 4:23 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply