BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I place form2 within form1?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General)
View previous topic :: View next topic  
Author Message
Kevin Pollard
Guest





PostPosted: Fri Nov 07, 2003 8:11 pm    Post subject: How do I place form2 within form1? Reply with quote



I want to create a form (call it form2) that always displays on the
same position on top of my main form (form1). To illustrate what I'm
trying to do, let's say I divide my main form into two areas (maybe
panels) - the first area has a button in it, the the second area is
blank.

I want form2 to act like a subform of form1.

At run time when the user clicks on the button I want a form to appear
in the second area. The point is I want be able to position form2 to
be in a specific position relative to form1.

How can I do this in Delphi6?
Back to top
Cecile Muller
Guest





PostPosted: Sat Nov 08, 2003 7:03 am    Post subject: Re: How do I place form2 within form1? Reply with quote



Quote:
I want form2 to act like a subform of form1.
How can I do this in Delphi6?

In the procedure of the button clicked, put something like:
Form2.Left := Form1.Left + offsetX;
Form2.Top := Form1.Top + offsetY;
Form2.Show;
(offsetX and offsetY being two constant integers)

You will have to actualize Form2.Top and Form2.Left when the user
moves Form1 too.


But do you really need to use a second form, maybe a simple Panel
could fit, make is invisible at startup and change its Visible value
for showing/hiding it, and you wouldn't need to set its position as
it's done automatically thanks to the anchors.

Back to top
Martin Strand
Guest





PostPosted: Sat Nov 08, 2003 8:40 am    Post subject: Re: How do I place form2 within form1? Reply with quote




"Kevin Pollard" <kpollard (AT) scu (DOT) edu.au> wrote

Quote:
I want to create a form (call it form2) that always displays on the
same position on top of my main form (form1). To illustrate what I'm
trying to do, let's say I divide my main form into two areas (maybe
panels) - the first area has a button in it, the the second area is
blank.

I want form2 to act like a subform of form1.

At run time when the user clicks on the button I want a form to appear
in the second area. The point is I want be able to position form2 to
be in a specific position relative to form1.

How can I do this in Delphi6?

What about MDI? Multiple Document Interface?
It's described in the help file.



Back to top
Kevin Pollard
Guest





PostPosted: Mon Nov 10, 2003 3:20 am    Post subject: Re: How do I place form2 within form1? Reply with quote

[email]spam (AT) wildpeaks (DOT) com[/email] (Cecile Muller) wrote in message news:<aff31ac6.0311072303.61174af6 (AT) posting (DOT) google.com>...
Quote:
I want form2 to act like a subform of form1.
...

But do you really need to use a second form, maybe a simple Panel
could fit, make is invisible at startup and change its Visible value
for showing/hiding it, and you wouldn't need to set its position as
it's done automatically thanks to the anchors.

This sounds like a good idea and is easy to understand.

The particular application is a simple one. I would have a main form
and about 4 or 5 other forms. Has anyone tried this with a more
complex application - with 30 or so forms.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.