Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which object called me?
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00859119
Message ID:
00859179
Views:
16
>>Hello all,
>>
>> How do I tell a form which commandbutton on another form called it?
>>
>>Thanks
>
>Not related to MM framework in any way, but here is a little trick:
>
>When the called form initializes, the _screen.ActiveForm still points to the calling form.
>
>So, in the FORM2.Init()
>
>
>oCallingForm =_screen.ActiveForm && gives you the reference to the calling form
>oCallingControl = _screen.ActiveForm.ActiveControl  && gives you the reference to the button it was called from.
>
>
>This allows to avod passing any parameters. You can save the object references to the Form2 properties if you want. And I would prefer to save the hierarchy names (SYS(1272)) instead, to avoid the dangling object references. You can always get the object reference again with EVALUATE() function when necessary.


Great tip Nick. We may be splitting hairs in this case but when I'm working with MM I pass a parameter because I don't call the second form from the button click method. Kevin has drilled it into my head to put code on the business object, not the form. I'll have to do some testing to see if the button would still be the ActiveControl.
Bob Kocher
www.swfox.net
Start making your plans now to attend Southwest Fox 2006
Previous
Reply
Map
View

Click here to load this message in the networking platform