Thanks Ingo. I see that I can do it that way. My question was is the
OnActivate event on a form "intentionally" set to fire every time the form
is restored. It's almost like a GotFocus event.
From the help file:
Event that is produced every time that the form is activated.
Parameters:
<oSender>:
Self reference
<oForm>:
Previous form that gives the current status to the form or NIL
Return value:
NIL
From the help file description, the word "activated" is ambiguous. If the
current behavior is by design, then it would be more accurate to replace
"activated" with "Receives Focus" or "Restored", or whatever -- something a
little more descriptive.
I just need to know this for the future. I discoverd this behavior by
placing a button on the MdiChild which when clicked, called a standard alert
message box. When the alert box was closed, the MdiFrame OnActivate event
fired.
I have attached a sample.
"Ingo" <
ingo.jh@web.de> wrote in message
news:[email=
439aa459@ozsrvnegro.ozlan.local...]
439aa459@ozsrvnegro.ozlan.local...[/email]
> Andrew,
>
> I create and show the MdiChild after showing the MdiFrame like this:
>
> Procedure Main()
> Application:cTitle := "LEI§A"
> Application:oIcon := "Law"
> Init()
> Application:Run()
>
> Return
>
> //---------------------------------------------------------- --------------------
>
> Procedure Init()
> LOCAL oMain
> REQUEST HB_LANG_DE
> HB_LANGSELECT( "DE" )
> REQUEST HB_CODEPAGE_DE
> HB_SetCodePage( "DE" )
> ....
> ....
>
> WITH OBJECT oMain:=TMain():New( Application ) //creating MdiFrame
> ....
> ....
> ....
> :Show()
> END
> ChildForm():New(oMain):Show() //creating MdiChild
> RETURN
>
> Regards
>
>
>
> "Andrew W. Ross" <
awr@jps.net> schrieb im Newsbeitrag
> news:439a91ef$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
>> Is the OnActivate supposed to fire everytime the form is restored? It
>> seems to me that the OnShow should but *not* the OnActivate.
>
> That's right.
> The OnActivate event is produced every time the form is activated.
> OnShow event is produced after creating and initializing the form as I
> think
> so.
>
>> I am trying to automatically show a MdiChild at startup, but I cannot use
>> the OnInitialize event. When I place the code "TMdiChild():New(
>> Self ):Show()" in the MdiFrame OnInitialize event, I get the following:
>>
>> TMDICHILD:SHOW(414)
>> Error BASE/1004 Class: 'NIL' has no exported method: SENDMSG
>> Arguments: ( [ 1] = Type: N Val: 546 [ 2] = Type: N Val:
>> 0)
>>
>> No problem, I think, it must be because the MdiFrame is not yet shown, so
>> I put it in the OnActivate event. But every time I minimize and restore
>> the MdiFrame, the OnActivate code is fired and I get another MdiChild
>> created.
>
> I got the same error therefore I create and show the MdiChild after
> showing
> the MdiFrame like this:
>
> Procedure Main()
> Application:cTitle := "LEI§A"
> Application:oIcon := "Law"
> Init()
> Application:Run()
>
> Return
>
> //---------------------------------------------------------- --------------------
>
> Procedure Init()
> LOCAL oMain
> ....
> WITH OBJECT oMain:=TMain():New( Application ) //creating MdiFrame
> ....
> :Show()
> END
> TMdiChild():New(oMain):Show() //creating MdiChild
> RETURN
>
>
> Regards
>
> Ingo
>
>
>> Help me out please.
>>
>> Thanks,
>>
>> Andy
>>
>
>
Attached files MDISample1.zip (2.5 KB)Â