Page 1 of 1

An HMG "Hidden" feature...

Posted: Sun Aug 31, 2008 12:55 am
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.

Re: An HMG "Hidden" feature...

Posted: Sun Aug 31, 2008 1:25 am
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

Re: An HMG "Hidden" feature...

Posted: Sun Aug 31, 2008 1:39 am
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.

Re: An HMG "Hidden" feature...

Posted: Sun Aug 31, 2008 1:50 am
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

Re: An HMG "Hidden" feature...

Posted: Sun Aug 31, 2008 3:17 am
by Rathinagiri
Stay tuned... More 'hidden' features will be come...

:)

So, it is proved that HMG is a treasure. Please do a hunt.

Re: An HMG "Hidden" feature...

Posted: Sun Aug 31, 2008 4:59 pm
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.

Re: An HMG "Hidden" feature...

Posted: Tue Oct 07, 2008 1:39 am
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.