I use to use the simple option of settings the forms Top, Left, Height, 
and
Width, but if the window was maximized when the app was closed, it would 
save the size of the full screen, so there is no easy way for the user 
to restore to the original position before the maximize.

Storing and loading the rcNormalPosition, and the WindowState solves 
that problem.

I suppose I could try using alClient Alignment.  I do have controls 
above and below the listview which could go into separate panels if 
necessary.  I'm not sure if it will make any difference but I will try 
this and send it to a user for testing.  The Anchors should still work 
though.

I'm wondering if the bug in Win2k is due to the SetWindowPlacement being 
done too close to the change of WindowState.  Perhaps the WindowState is 
non-modal and is performing operations while the WindowState is being 
set and stuffs something up.  A Sleep() may solve it.

I didn't mention it as I don't think it's related but I'm also restoring 
the column positions of the listview immediately after the main form 
sizing and positioning.

I was hoping someone else had used SetWindowPosition and come across 
this problem on Win2k with a solution, but it appears not.

Something I just thought of may work.  I could store the 
rcNormalPosition but convert this into Height (Bottom - Top) and Width 
(Right - Left) when loading the figures and use the standard Form 
properties.  This will likely fix it properly.

Regards,
Ross.

----- Original Message ----- 
From: "Robert Meek" <[EMAIL PROTECTED]>
To: "'Borland's Delphi Discussion List'" <[email protected]>
Sent: Monday, October 17, 2005 5:52 AM
Subject: RE: Win2k window problems


I think you should be resetting the form's Top, Left, Height, and
Width instead of as you are with the Bottom and Right.  This always 
worked
for me in Windows 95, 98, 2000 and XP.  Make sure too that the alignment 
of
your TListView is set to alClient.  Just setting your anchors is NOT the
same!  If you can't align to alClient because of needing space between 
it
and it's parent's borders, use panels or spacers in between so that you 
can.
Also, I've experienced a lot of registry problems with Win2000.  For
example, even with Microsoft's own products when uninstalled, registry
entries were not always cleaned up as they should be.  So I stopped 
using
the Registry except for those things that were absolutely necessary. 
For
everything else I went back to inifiles and the only difference I 
noticed
was an increase in speed! <g>

from: Robert Meek at: [EMAIL PROTECTED]
dba "Tangentals Design" home of "PoBoy"
freeware Windows apps and utilities
located at: www.TangentalsDesign.com
Proud to be a moderator for the
"Delphi Programming Lists" at: elists.org


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf
Of Ross Levis
Sent: Saturday, October 15, 2005 8:54 PM
To: Delphi Discussion List
Subject: Win2k window problems

I have a problem which only occurs on Windows 2000 workstations.  XP and
Win9x work fine.

I'm storing the window sizes and positions of several windows when
closing my app.  I'm using similar code to the following when my program
loads:

 with WindowPlacement do //(TWindowPlacement)
 begin
    Length := Sizeof(WindowPlacement);
    rcNormalPosition.Top := Reg.ReadInteger('Top');
    rcNormalPosition.Left := Reg.ReadInteger('Left');
    rcNormalPosition.Bottom := Reg.ReadInteger('Bottom');
    rcNormalPosition.Right := Reg.ReadInteger('Right');
    showCmd := SW_HIDE;
    SetWindowPlacement(MyForm.Handle, @WindowPlacement);
    MyForm.WindowState := TWindowState(Reg.ReadInteger('State'));
 end;

In one example, a form has a ListView which is anchored at Top, Left,
Bottom, and Right.  On Win2k (and only Win2k), the listview does not
resize when the window is resized.  It stays the same size so you end up
with blank space to the right and bottom when the form is made bigger or
maximized.  It's as if the 4 Anchors are set to False.  This only occurs
after the above code is run.

The reason for using SetWindowPlacement is so the restored size of the
windows are stored and loaded regardless of whether the form is
maximized or not.  The user can then Restore to the original form size.

I don't have Win2k here so it's my users who have reported this problem
and I can't test any changes here to resolve it.

Any ideas?

Thanks,
Ross.

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to