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!

Displaying a form on a form

Status
Not open for further replies.

irace

Programmer
Apr 13, 2006
3
US
I have form with a listbox on it. When a user selects an item from the listbox, a form is called and opened. What I would like to have happen is the called form to display on the same form with the listbox -- assuming the form with the listbox is big enough to fit the called form.

For example, the same idea how a web browser (with frames) can call other html file and display it on the same browser within the frame thus displaying everything on one browser.

Is my question clear? Am I asking the impossible? Any suggestions?

Thanks
 

Irace,

You can't display one form inside another, but there are plenty of ways of achieving the same effect.

One possibility would be to use a page frame with hidden tabs. At the point where you want to show the new "form", you would activate the second page. When the user clicks the "back button" or equivalent, you go back to page 1.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks Mike for the suggestion.

Going with your idea -- do you know how to retrieve a forms objects with their own properties, events, methods, etc. information as text during runtime?
 

Irace,

I'm not sure what you mean.

You can loop through all the controls on the form by iterating its Controls collection:

FOR EACH oControl IN THISFORM.Controls
&& oControl will contain the next control.
&& You can access its properties and methods
ENDFOR

Also, you can use AMEMBERS() to get the names of all the objects, properties and methods into an array.

But what do you mean by retrieving them "as text"?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

You answered my question. Sorry I wasn't clear when I mentioned "as text". What I was trying to get were the properties, methods, etc. (as you mentioned) into some form of a string that I could caputre during runtime.

The array idea will do just that.

Thanks so much.

You da man.

 
Mike said:
You can't display one form inside another...
You can providing the 'parent' form is Top-Level, the 'child' form's .ShowWindow value is 1, and the 'child' form is called from the .Activate() or chronologically later event/method of the 'parent' form.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 

Chris,

I see what you mean, but don't agree that would display one form insidethe other. They'd still be separate forms; one would superimpose the other. I agree that might meet Irace's requirement, but only if he was using a top-level form anyway.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike

Mike said:
but don't agree that would display one form inside the other
Afraid I don't quite buy that argument. [smile]


All VFP controls that are in containers, which in this case is a form contained within a form, are separate controls that are superimposed on each other but contained with the borders of the parent control.

So what you appear to be saying is that, to be accurate, you cannot display any VFP control inside a VFP container because it would be superimposed on the VFP container?

I accept from a hierachal point of view the opposite appears to be true but the reality is that if the contained control was not superimposed on the VFP container, how else would it be accessed through the interface?

I rest my case, m'lud...

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
You can't display one form inside another, but there are plenty of ways of achieving the same effect.

As was already mentioned, this *is* possible with top-level forms...

But it is also possible with regular-old forms, and it's even easier ever since the HWND is now exposed by each form. See my (old) FAQ: faq184-2555

The TakeWindow function there needs a slight modification so that you simply pass in FirstForm.HWND and SecondForm.HWND, rather than requiring TakeWindow to use "FindWindow" to get the window handles.

However, I agree that a-form-inside-a-form probably isn't the best UI for what irace is trying to accomplish... I'd use the pageframes or dynamically-created container classes instead.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Technically, you don't even need to fiddle with hwnd to get a "window in window" look:

x = createobject("form")
x.name = "form1"
x.show()
y = createobject("form")
y.name = "form2"
y.show()
Activate Window (y.Name) in window (x.Name)

This is a throwback to all the kludges we used to have to go through to get browse/READ to play nice together.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top