Reading form's coordinates?

This is a discussion on Reading form's coordinates? within the Delphi forums in Programming Languages category; Hello I'd like to display a form, and when the user clicks on a button, display a second form that will overlay the first one. So I need to read the first form's coordinates (x,y,width,height). I googled the archives of this ng, but didn't find the answer. Does Delphi provide a function for this, or do we need to call a Win32 API? Thank you....

Go Back   Application Development Forum > Programming Languages > Delphi

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-05-2008, 05:42 AM
Gilles Ganault
Guest
 
Default Reading form's coordinates?

Hello

I'd like to display a form, and when the user clicks on a button,
display a second form that will overlay the first one. So I need to
read the first form's coordinates (x,y,width,height).

I googled the archives of this ng, but didn't find the answer. Does
Delphi provide a function for this, or do we need to call a Win32 API?

Thank you.
Reply With Quote
  #2  
Old 08-05-2008, 06:21 AM
Peter Below (TeamB)
Guest
 
Default Re: Reading form's coordinates?

Gilles Ganault wrote:

> Hello
>
> I'd like to display a form, and when the user clicks on a button,
> display a second form that will overlay the first one. So I need to
> read the first form's coordinates (x,y,width,height).
>
> I googled the archives of this ng, but didn't find the answer. Does
> Delphi provide a function for this, or do we need to call a Win32 API?
>
> Thank you.


Is this a trick question or what? Did you never notice the Top, Left,
Width and Height properties of a form? IN fact about every control has
these properties. Top and Left are relative to the parent controls
client area. For a form with no parent they are relative to the screen.

--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Reply With Quote
  #3  
Old 08-05-2008, 08:30 AM
Marc Rohloff [TeamB]
Guest
 
Default Re: Reading form's coordinates?

On 5 Aug 2008 03:21:40 -0700, Peter Below (TeamB) wrote:

> Is this a trick question or what? Did you never notice the Top, Left,
> Width and Height properties of a form? IN fact about every control has
> these properties. Top and Left are relative to the parent controls
> client area. For a form with no parent they are relative to the screen.


Or even simpler. Form2.BoundsRect := Form1.BoundsRect
But I would recommend using a single form and create the two
alternative views using something like a page control or frames.

--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
Reply With Quote
  #4  
Old 08-05-2008, 01:20 PM
Jens Gruschel
Guest
 
Default Re: Reading form's coordinates?

> Or even simpler. Form2.BoundsRect := Form1.BoundsRect

For maximized forms it might be a bit more tricky. IIRC your code works
but looks ugly on multi head environments (the border might be visible
on another screen).

> But I would recommend using a single form and create the two
> alternative views using something like a page control or frames.


Me, too. However IIRC even Microsoft uses another window with same
position and size on top of the main window for the print preview in IE7 :-)


--
Jens Gruschel
http://www.pegtop.net
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:51 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.