Well as I HAD been doing it. As I said I only stored settings that were not maximized nor minimized for that matter, So if the form were in either of these two states the next time created and shown, they would appear at the last stored position. If I was merely re-showing a form that was not actually closed in-between, then I also would only restore it to it's current position. The short answer...no, I wouldn't because both settings can be reset on-demand at tiny time!
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 Glen Thompson Sent: Wednesday, October 19, 2005 7:10 AM To: Borland's Delphi Discussion List Subject: RE: Win2k window problems I agree it's sometimes a good idea to remember windowstate as well as size and position. BTW, what do you think if the state is minimized when the application is closed? Should it be started minimized next time? I don't think it should, but I know there are others who disagree. Glen -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Robert Meek Sent: Wednesday, 19 October 2005 1:26 AM To: 'Borland's Delphi Discussion List' Subject: RE: Win2k window problems Well I wouldn't call it overkill! I've been in similar situation though, where after wasting a day or two trying to solve a persnickety problem I've become frustrated and decided to drop the particular feature causing the problems. The next day however I feel so guilty I always would go back to it again! <g> And though I have never worried about this particular situation myself, that is, not saving position when maximized at closure, I think it's a great little addition for almost any application and since you brought it up I'm going to add it to my base template code! Let me know if and how you do finally solve it! 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: Monday, October 17, 2005 7:36 PM To: Borland's Delphi Discussion List Subject: Re: Win2k window problems Yeah, it's probably overkill what I'm doing. The advantage is that if a user resizes some forms manually by draging the window edges, but then sometimes maximizes a form, the size of the non-maximized form is saved, so it works just like the app was never closed, if you see what I mean. A Restore will restore the form to the size the user adjusted it to before the Maximize. It works quite nicely, except on Win2k. Ross. ----- Original Message ----- From: "Robert Meek" <[EMAIL PROTECTED]> To: "'Borland's Delphi Discussion List'" <[email protected]> Sent: Monday, October 17, 2005 9:14 PM Subject: RE: Win2k window problems How about adding a simple test to the saving code? If WindowState - wsMaximized then Exit Else Run Savecode; 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: Sunday, October 16, 2005 6:14 PM To: Borland's Delphi Discussion List Subject: Re: Win2k window problems 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 _______________________________________________ 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 _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

