Board index » delphi » Form Position Property & Save Size and Position

Form Position Property & Save Size and Position

Hi,

In D3 I have a question regarding the use of the Form Position
Properties, poDefault and poDesigned, as they relate to the ability to
save the Form's Size and Position.

I have been using poDesigned, thinking this was the only property that
would allow me to save the Form's Size and Position to the Registry. The
problem is that if I work in 1024x768 and compile the project with the
Form in my screen center, it opens in the lower right corner of 800x600
and mostly off screen for 640x480.

I am now trying to use poDefault, which I did not think would allow me to
save the Form's Size and Position. BUT, to my amazement, the first time
the Form is opened, it opens nicely in view and it's Size and Position is
saved to the Registry and opens according to those saved settings.

I know what I am seeing, but I have been using poDesigned so long, that I
want to ask what others use and if I will run into troubles on
different computers and resolutions if I use poDefault and save the
Form's Size and Position.

 

Re:Form Position Property & Save Size and Position


On Mon, 22 Jun 1998 23:30:34 -0700, kenNOh...@dcalcodaNO.com (Ken

Quote
Hale) wrote:
>Hi,

>In D3 I have a question regarding the use of the Form Position
>Properties, poDefault and poDesigned, as they relate to the ability to
>save the Form's Size and Position.

>I have been using poDesigned, thinking this was the only property that
>would allow me to save the Form's Size and Position to the Registry. The
>problem is that if I work in 1024x768 and compile the project with the
>Form in my screen center, it opens in the lower right corner of 800x600
>and mostly off screen for 640x480.

>I am now trying to use poDefault, which I did not think would allow me to
>save the Form's Size and Position. BUT, to my amazement, the first time
>the Form is opened, it opens nicely in view and it's Size and Position is
>saved to the Registry and opens according to those saved settings.

>I know what I am seeing, but I have been using poDesigned so long, that I
>want to ask what others use and if I will run into troubles on
>different computers and resolutions if I use poDefault and save the
>Form's Size and Position.

The TWindowPlacement object is a record that contains information
about a windows size, state and location.

The API call GetWindowPlacement fills the record using the window
handle. WVSPrintf can be used to fill a buffer that can then be
written to the registry using a TRegIniFile. When the window is
restored, the string is read from the registry and used to fill a
TWindowPlacement record. The record's contents are assigned to the
window using SetWindowPlacement.

regards
A.G.

Re:Form Position Property & Save Size and Position


Hi,

I sent this into the Newsgroup and did not see it after several hours, so
am resending it. Sorry if it is a duplicate.

In D3 I have a question regarding the use of the Form Position
Properties, poDefault and poDesigned, as they relate to the ability to
save the Form's Size and Position.

I have been using poDesigned, thinking this was the only property that
would allow me to save the Form's Size and Position to the Registry. The
problem is that if I work in 1024x768 and compile the project with the
Form in my screen center, it opens in the lower right corner of 800x600
and mostly off screen for 640x480.

I am now trying to use poDefault, which I did not think would allow me to
save the Form's Size and Position. BUT, to my amazement, the first time
the Form is opened, it opens nicely in view and it's Size and Position is
saved to the Registry and opens according to those saved settings.

I know what I am seeing, but I have been using poDesigned so long, that I
want to ask what others use and if I will run into troubles on
different computers and resolutions if I use poDefault and save the
Form's Size and Position.

Ken Hale

Re:Form Position Property & Save Size and Position


Ken,

poDefault works fine for what you want... In fact, most Windows
apps written in C/C++ have always used CW_DEFAULT for the initial
window position in the CreateWindow() function.

poDesigned, OTOH, will always put the window at the coordinates
you used at design time; this can even be somewhere totally
outside the viewable area of the screen.

HTH

Ken
--
Ken White
kwh...@westelcom.com

Clipper Functions for Delphi
http://members.aol.com/clipfunc/

Quote
Ken Hale wrote:

> Hi,

> In D3 I have a question regarding the use of the Form Position
> Properties, poDefault and poDesigned, as they relate to the ability to
> save the Form's Size and Position.

> I have been using poDesigned, thinking this was the only property that
> would allow me to save the Form's Size and Position to the Registry. The
> problem is that if I work in 1024x768 and compile the project with the
> Form in my screen center, it opens in the lower right corner of 800x600
> and mostly off screen for 640x480.

> I am now trying to use poDefault, which I did not think would allow me to
> save the Form's Size and Position. BUT, to my amazement, the first time
> the Form is opened, it opens nicely in view and it's Size and Position is
> saved to the Registry and opens according to those saved settings.

> I know what I am seeing, but I have been using poDesigned so long, that I
> want to ask what others use and if I will run into troubles on
> different computers and resolutions if I use poDefault and save the
> Form's Size and Position.

Re:Form Position Property & Save Size and Position


In article <358FBC4B.C9ED3...@westelcom.com>, kwh...@westelcom.com
says...

Hi,

Thank you for your reply. I will start using poDefault for my forms and
see how it goes. It certainly seems to be working fine now.

It is really nice to find a better solution to the problem of the form
opening up in odd positions on different resolutions!

Ken Hale

Quote
> poDefault works fine for what you want... In fact, most Windows
> apps written in C/C++ have always used CW_DEFAULT for the initial
> window position in the CreateWindow() function.

> poDesigned, OTOH, will always put the window at the coordinates
> you used at design time; this can even be somewhere totally
> outside the viewable area of the screen.

Other Threads