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

maximize parent form from child form? 1

Status
Not open for further replies.

jhall251

Programmer
Dec 7, 2000
84
US
I have a form that calls a search form that in turn calls a results form that displays a lengthy client record. I'd like the user to be able to maximize this form, resizing the data for readability. Currently this is only possible if the calling form has been maximized before the results form is instantiated - because the results form will only max to the boundary of the parent form. Since the results form is modal, the user cannot max the parent form without exiting the child.

I'm not sure of the best way to fix this and I am looking for ideas. Thanks for any help.

Joe Halloran
 
Hi

You have not said, if the form is a Top level form or a form on _screen. in the later case, you can simply make _screen.WindowState = 2
ThisForm.WindowState = 2

:)


____________________________________________
ramani - (Subramanian.G) :)
 
Thanks - no the calling form is a top-level form.

Joe Halloran
 
Joe,

In the Load event of the child form, do this:

THISFORM.oCaller = _SCREEN.ActiveForm

(where oCaller is a custom property of the child form).

This will store an object reference to the calling form in the specified property.

Then, any time you want to maximise the caller from within the child, do this:

THISFORM.oCaller.WindowState = 2

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks Mike - that works.

I am also considering changing the ShowWindow to Top Level - then it can be sized independent of the calling window. I think I can make the calling window unavailable while the called window is active with .visible = .f. - or disable the button that calls the child window. Does this approach seem workable?

One related question - It looks like vfp windows will minimize and maximize but are not resizeable on a continuum like most windows - am I missing a setting here?

Thanks for your help!!

Joe Halloran
 
Check the BorderStyle property or the form.

Regards,

Mike
 
Joe,

I am also considering changing the ShowWindow to Top Level - then it can be sized independent of the calling window. I think I can make the calling window unavailable while the called window is active with .visible = .f. - or disable the button that calls the child window. Does this approach seem workable?

That should work, but it would be easier to make the child window modal. But it's an either/or choice. You can't have it both modal and top level.

It looks like vfp windows will minimize and maximize but are not resizeable on a continuum like most windows - am I missing a setting here?

That's not the case. VFP forms behave like normal windows in that respect. Just make sure that the BorderStyle property is less than 3.

Thanks for the star.

Mike



Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks for borderstyle tip.


After some experimentation I am back to using a reference to the parent window and putting the following in the child window resize event:

Code:
thisform.oCallingWindow.windowState = thisform.WindowState
thisform.resizeroutine && a control resizing class

This works great - except for the case where the windows are minimized and then restored - in that case the parent window restores first, the child window then has to be restored separately. In this case the parent window needs to talk to the child window instead of vice versa. Any way to do that?

Thanks as always...

Joe Halloran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top