How to refer to a formowner when use the Showform method
Posted: Tue Apr 24, 2018 3:25 pm
Hi,
When a member form is opened by the ShowForm method, the FormOwner of that form is NULL.
The following two codes are samples for confirming this behavior.
How to refer to the FormOwner in a member form when use the ShowForm method?
Regards,
Taku Izumi
When a member form is opened by the ShowForm method, the FormOwner of that form is NULL.
The following two codes are samples for confirming this behavior.
Code: Select all
* Owner Form code
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(484) Clientheight(301) Componentversion(2) Left(652) Top(212)
Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Show MemberForm') Displayposition(1) Left(40) Parent(#COM_OWNER) Tabposition(1) Top(29)
Define_Com Class(#FormB) Name(#FormB)
Evtroutine Handling(#Button1.Click)
#FormB.FormOwner <= #COM_OWNER
#FormB.ShowForm
Endroutine
End_Com
Code: Select all
* Member form code
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(484) Clientheight(301) Componentversion(2) Left(577) Top(288)
Define_Com Class(#PRIM_LABL) Name(#Label1) Caption('Label1') Displayposition(1) Ellipses(Word) Height(25) Left(83) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(102) Verticalalignment(Center) Width(334)
Evtroutine Handling(#com_owner.CreateInstance)
Set Com(#com_owner) Caption(*component_desc)
If Cond(#COM_OWNER.FormOwner *Is *NULL)
#Label1.Caption := 'FormOwner is Null'
Else
#Label1.Caption := 'FormOwner is ' + #COM_OWNER.FormOwner.Name
Endif
Endroutine
End_Com
Regards,
Taku Izumi