Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a Form from a Form and Switching Back 3

Status
Not open for further replies.

Menglish

Programmer
Jun 22, 2001
66
I have been searching through the FAQ's but have been unable to resolve my problem.

I am in Form1, and when the command button is clicked, I issue to command:
thisform.visible=.F.
do form2
read events
and this works fine.


Now is my problem. When I close form2 with "thisform.release()", how do I restore Form1? Issuing the command thisform.Form1.visible=.T. generates an error.

Any suggestions?

Thanks for any assistance.

Millard English
 
Menglish

You have to use a NAME clause,in order to be able to refer to your forms later.
PUBLIC oForm1,oForm2
DO form form1.scx NAME oForm1
&&Do form form2.scx NAME oForm2

Now when you need to bring back form1 you would use:
oForm1.visible = .t.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Also, You only ever need one READ EVENTS command in your program... you don't have to call it after launching each form, like in the old FoxproDos READ command.
 
Since you are making Form1 invisible, you really intend to prevent the user from using it when in Form2. So, the solution is to make Form2 MODAL (Window Type = 1)

Then, from Form1's control you issue the following:


Thisform.hide
do form Form2
Thisform.show()

You can also return a value from Form2 (as in a function) if you wish. To do this...

local myvar
myvar = ""
Thisform.hide
do form Form2 to myvar
Thisform.show()

In Form2's Unload method, RETURN any result of the type of myvar (in this example, char).

Tony Vignone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top