An HMG "Hidden" feature...

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

An HMG "Hidden" feature...

Post by Roberto Lopez »

Hi All,

I had not a 'master plan when started HMG.

In fact, during the first year of development, MiniGUI library 'mutated' various times (those that had 'traveled' with me from the beginnig had 'suffered' that :) ).

The semi-oop syntax appeared about one year after the first version of MiniGUI library was released.

At that time I've made various big changes about general design, one of those, was that the Tab control shoud be a 'container' for other controls.

Is well known for all HMG users that coordinates for tab-child controls are referred to Tab and not to the parent window as other controls.

That's right, but look at this:

Code: Select all

    DEFINE TAB Tab_1;
        OF Win_1 ;
        AT 10,10 ;
        WIDTH 600 ;
        HEIGHT 400 

        PAGE 'Page 1' 

            @ 100,100 BUTTON Button_1 ;
                CAPTION "Test" ;
                WIDTH 50 ;
                HEIGHT 50 ;
                ACTION MsgInfo('Test!')

        END PAGE

    END TAB
All HMG users (including me) refers to button in this way:

Code: Select all

Win_1.Button_1.Caption := 'New Caption'
This is possible because 'backwards compatibility' with first MiniGUI versions, but... is wrong (or 'almost' wrong :) ).

The 'right' way is:

Code: Select all

Win_1.Tab_1(1).Button_1.Caption := 'New Caption'
Since, Tab is a container.

Some days ago, I've discovered that this alternate ('correct') way to refer to tab-child controls was broken (from a long long time ago) and nobody noticed about that...

This is absolutely my fault, since the users learns HMG mainly via the bundled samples and those samples do not show the right way.

Most users (and me) had made a choice. The choice was alternate syntax for control definition and semi-oop for accessing at runtime. This is 'logical', since that is the easiest way to write and maintain the code.

I'll try to encourage users via the new samples and documentation to code this way, tagging other (alternate) methods as 'not recommended' and available for backwards compatibility only.

Stay tuned... More 'hidden' features will be come... :)

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: An HMG "Hidden" feature...

Post by esgici »

Roberto Lopez wrote: This is possible because 'backwards compatibility' with first MiniGUI versions, but... is wrong (or 'almost' wrong :) ).
Interesting :o
I'll try to encourage users via the new samples and documentation to code this way, tagging other (alternate) methods as 'not recommended' and available for backwards compatibility only.
This is good news :)
Stay tuned... More 'hidden' features will be come... :)
We will wait with curiosity and patience. I hope that you will announce changes on samples :)

Best regards

--

esgici
Viva INTERNATIONAL HMG :D
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: An HMG "Hidden" feature...

Post by Roberto Lopez »

We will wait with curiosity and patience. I hope that you will announce changes on samples :)
Well... there is 150+ samples. I have no plans to rewrite all of them right now...

I'll put my efforts in new samples :)

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: An HMG "Hidden" feature...

Post by esgici »

Roberto Lopez wrote: I have no plans to rewrite all of them right now...
Of course ... :)

TAB sample has been changed ( added Optional Syntax (Reffer button as tab child ) ) in Vers. 2.6.0 and I don't have noticed :(

Best Regards.

--

esgici
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: An HMG "Hidden" feature...

Post by Rathinagiri »

Stay tuned... More 'hidden' features will be come...

:)

So, it is proved that HMG is a treasure. Please do a hunt.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: An HMG "Hidden" feature...

Post by Roberto Lopez »

Roberto Lopez wrote: The 'right' way is:

Code: Select all

Win_1.Tab_1(1).Button_1.Caption := 'New Caption'
By the moment, you must be careful and use this syntax for experimentation only, since I've found some incompatibilities that I've fixed, but I want to do more tests before release it.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
luisvasquezcl
Posts: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: An HMG "Hidden" feature...

Post by luisvasquezcl »

Estimado Roberto,
siempre pensé en que cada ventana contenedora debería tener su propio array de controles.
Esto llevaria a una mejora en el rendimiento de la libreria ya que acota la busqueda sólo al array contenido por la ventana señalada.
Me tomé la libertad de hacerte este comentario, es solo una idea que siempre tuve y no la expresé, bueno, ahora si 8),
Saludos cordiales,
Luis Vásquez.
Post Reply