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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

child form dissapear after return back to parent form

Status
Not open for further replies.

koklimabc

Programmer
Jun 17, 2013
49
MY
Dear all,

I need someone to help me where I press "F5" to invoke child form and then i click back to one control, the child form was just disappeared. How could i possible to make the child form to be stayed in screen whenever i'd return back to parent form's control.

Coding to invoke child form by pressing "F5"
LPARAMETERS nKeyCode, nShiftAltCtrl
if nKeyCode = -4


thisform.page_.pages(thisform.page_.activepage).addproperty("frmlocinv")
thisform.page_.pages(thisform.page_.activepage).frmlocinv = createobject("frmpurc")
thisform.page_.pages(thisform.page_.activepage).frmlocinv.show()
thisform.page_.pages(thisform.page_.activepage).frmlocinv.move(objtoclient(this,2)-this.width,;
objtoclient(this,1)+50)
endif

Coding for my custom child form
define class frmpurc as form
showwindow = 1
caption = "Search from purchase history"
name = "frmpurc"

procedure init

endpro

procedure destroy
clear events
endpro


enddefine

-I've atatched picture for more info in details.Appreciate Thankful to someone could help.
 
 http://files.engineering.com/getfile.aspx?folder=d690e357-c9e8-4679-b35a-fd00366f31d9&file=Quest.jpg
First thing I notice: READ EVENTS / CLEAR EVENTS is a pair of commands used for the whole application, not for each form.

You don't show when, where and how you go back to the parent form, so there is no idea, why your child form vanishes. As you start it you store a reference into the page property frmlocinv you add at that stage. If you reenter that code you readd that property and thereby release the current child form. Is that the problem?

Bye, Olaf.
 
Are you sure the child form is completely disappearing? Is it possible that it is simply hidden behind the main form?

In your screen shot, the main form appears to be larger than the child form. Given that the child form is modeless, when you click anywhere in the main form, I'd expect the main form to come to the front, covering the child form. If you move the main form out of the way, the child form would become visible again.

Also, I'd question your whole approach. Every time the user hits F5, you add a property to the main form, and create a new instance of the child form. It would make more sense to check to see if the child form already exists; if it doesn't, go ahead and create it, otherwise simply bring it to the front.

And why have you got CLEAR EVENTS in the Destory of the child form? That doesn't make any sense.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top