Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Know the name tthe form1 that call form 2
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00660923
Message ID:
00660934
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
Pedro,

>I have two forms , form1 and form2 .
>Form1 calls with do form ... , form3 or form4
>Form2 calls with do form ... , form5 or form 6
>
>When form3 has the focus , how can i , know , what form call is ?
>I want know the parent , the form3 . Is parent form1 or form2 ?


Call the Child-Form passing the parent-form as a parameter. So You
always have the object-Reference
FORM1.cmdOK.Click

do form FORM3.SCX with thisform
 
ENDPROC

FORM3.INIT
lparameters to_Parent

if vartype(to_Parent) = "O" and ! isNull(to_Parent)
  *-- You will need to ad a property like o_Parent 
  *-- to the form or if You have VPF7, You can use
  *-- .AddProperty("o_Parent", to_Patent)
  this.o_Parent = to_Parent
endif

ENDPROC

FORM3.DESTROY
   *-- This is very important. You will need to
   *-- get rid of the object-Reference
   This.o_Parent = .NULL.
ENDPROC
Now You can do everything with Form1 (or Form2) from within Form3
You could do being on the form itself using thisform.o_Parent
if Thisform.o_Parent.Name = frmForm1
  wait window "Hey, I have been called by FORM 1"
else
  wait window "I am visible, because FORM 2 asked me to do so"
endif
You have to take care that You do not close the parent form
before closing the child-form as the object-reference attached
to form3 would still be there.

HTH
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform