Página 1 de 1

OnActivate with TMdiFrame Form

Publicado: Sab Dic 10, 2005 9:29 am
por awr
Is the OnActivate supposed to fire everytime the form is restored? It seems
to me that the OnShow should but *not* the OnActivate.
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.
Help me out please.
Thanks,
Andy

OnActivate with TMdiFrame Form

Publicado: Sab Dic 10, 2005 10:48 am
por Ingo
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
>

OnActivate with TMdiFrame Form

Publicado: Sab Dic 10, 2005 4:17 pm
por awr
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)Â

OnActivate with TMdiFrame Form

Publicado: Dom Dic 11, 2005 11:52 am
por jfgimenez
Andy,
> 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.
Yes, it's fired every time the form gets focus. It's like the OnEnter event
for controls.
> 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.
Sorry for the inconvenience. We'll try to modify the help files to explain
it better.
--
Regards,
Jose F. Gimenez

OnActivate with TMdiFrame Form

Publicado: Dom Dic 11, 2005 4:29 pm
por awr
Jose,
Thanks for the explanation. After experimenting a bit, I was able to achieve
what I wanted to do with the OnShow event. I am trying to avoid manual
coding as much as possible and let Xailer do the work for me.
BTW, the product is just amazing. I am having great fun experimenting with
some new ideas I have for an existing FiveWin, 16-bit application that I
need to redesign in 32-bit. So far, I think Xailer and Xharbour look like a
winner. You guys have done some awesome work.
Andy
"Jose F. Gimenez" <jfgimenez@wanadoo.es> wrote in message
news:439c04d4$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
> Andy,
>
>> 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.
>
> Yes, it's fired every time the form gets focus. It's like the OnEnter
> event for controls.
>
>
>> 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.
>
> Sorry for the inconvenience. We'll try to modify the help files to explain
> it better.
>
> --
> Regards,
>
> Jose F. Gimenez
>

OnActivate with TMdiFrame Form

Publicado: Dom Dic 11, 2005 6:16 pm
por Ingo
Andy,
I agree with you. Xailer is really amazing. I just redesigned my first FW16
app. It's a great pleasure to work with the IDE.
Regards
Ingo

OnActivate with TMdiFrame Form

Publicado: Dom Dic 11, 2005 8:17 pm
por jfgimenez
Andy,
> BTW, the product is just amazing. I am having great fun experimenting with
> some new ideas I have for an existing FiveWin, 16-bit application that I
> need to redesign in 32-bit. So far, I think Xailer and Xharbour look like
> a winner. You guys have done some awesome work.
Thanks for the kind words ;-)
--
Regards,
Jose F. Gimenez

OnActivate with TMdiFrame Form

Publicado: Dom Dic 11, 2005 8:17 pm
por jfgimenez
Ingo,
> I agree with you. Xailer is really amazing. I just redesigned my first
> FW16 app. It's a great pleasure to work with the IDE.
Thanks to you also ;-)
--
Regards,
Jose F. Gimenez