HMG Program Error on MultiChild Form

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

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

Re: HMG Program Error on MultiChild Form

Post by Roberto Lopez »

Czarny_Pijar wrote:
Roberto Lopez wrote: Your sample is incorrect.

You must activate the three windows:

Code: Select all

        Activate Window Main , form_child , form_child2
There is various samples where multiple window activation is used.
I've tested before this change and I've not found problems.

Please consider that if you close a window using the [X] or ALT+F4 it is RELEASED from memory, so it cannot be shown or hidden, since it does not exists anymore.

If you use the NOAUTORELEASE clause when defining a window, it will be hidden instead released when you close with [X] or ALT+F4.

All of this are explained in the samples at \samples\noautorelease.

So, the program behaves as it should.
Czarny_Pijar wrote: In my demo I've activated the windows in a different style:

Code: Select all

        Main.Activate
        form_child.Activate
        form_child2.Activate
Neither of these is perfect from the point of view of the common clipper programmer (i.e. my ;) ). The first opens 3 windows at the start of the program, and Alt-F4 quirks are only delayed.
Is important to remark that this is not a matter of styles. The above code is incorrect and could produce unexpected results.
Czarny_Pijar wrote: The easy way is here:

Code: Select all

        Load Window Main
        Load Window form_child
        Load Window form_child2
        Main.Center
        Activate Window All
All works as expected. :)
I've introduced ACTIVATE WINDOW ALL command and NOAUTORELEASE windows clause as 'VB style' since, using it you could define all windows at startup and show or hide as needed with only one message loop (as in VB).

This is the help test on the samples:
* NoAutoRelease Style Demo

* Using this style speed up application execution, since the forms are
* loaded / created / activated only once (at program startup). Later you
* only must show or hide them as needed.
*
* NOAUTORELEASE window clause, makes that, when the user closes the windows
* interactively they are hide instead released from memory, then, there is
* no need to reload / redefine / activate prior show it again.
*
* NOSHOW clause makes that the windows be not displayed at activation.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMG Program Error on MultiChild Form

Post by Roberto Lopez »

Czarny_Pijar wrote:The various unexpected things happened when you have to issue Alt-F4 command while Child Window...
This is the same problem that you reported in IDE.

Releasing project or object inspector windows with alt+f4 you are releasing it from memory, so further attempts to access them will end with a runtime error.

I've eliminated the [X] from windows to avoid this but I've forgot to handle alt+f4.

I've fixed IDE simply avoiding that user alt+f4 have effect.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply