Page 3 of 5

Prg2Fmg Project

Posted: Fri Oct 14, 2016 10:41 pm
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.

Prg2Fmg Project

Posted: Sat Oct 15, 2016 2:01 am
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:

Re: Prg2Fmg Project

Posted: Sat Oct 15, 2016 8:12 am
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

Prg2Fmg Project

Posted: Sat Oct 15, 2016 12:34 pm
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.

Prg2Fmg Project

Posted: Sat Oct 15, 2016 1:12 pm
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... :)

Re: Prg2Fmg Project

Posted: Sat Oct 15, 2016 1:57 pm
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

Prg2Fmg Project

Posted: Sat Oct 15, 2016 2:10 pm
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. :)

Prg2Fmg Project

Posted: Tue Oct 18, 2016 12:32 pm
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.

Re: Prg2Fmg Project

Posted: Tue Oct 18, 2016 2:40 pm
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.

Prg2Fmg Project

Posted: Tue Oct 18, 2016 6:50 pm
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>