Form1.Position := poScreenCenter; Fails at runtime

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33417
    techie007
    Participant

    Hi all,

    I've been avoiding this for a while, but it's time to get it working. Currently I'm using v6.50Я;, I know the problem has existed in past releases.

    Here goes — I resize a form multiple tiems at runtime in an existing program; after each resize, I recentre it on the screen by issuing a “Form1.Position := poScreenCenter”. Works like a charm without the skinning.

    1. If the skin manager is active at startup then “Form1.Position := poScreenCenter” doesn't do anything at runtime. If you deactivate the skin manager during runtime, is still won't re-position.

    2. If a form is created with the skin manager Deactivated at start, setting Form1.Position := poScreenCenter properly repositions the form in the centre of the current screen.

    3. If the skin manager is deactivated at start, it will reposition, and then you activate the skin manager at runtime, and try to centre the form it throws an Access Violation (if launched in the IDE debugger it first throws a “raised exception class EOSError with a mesage 'A call to an OS function failed'.”)

    Attached is a zipped exe to show (some of) the wierdness.

    If you want to make your own — create a new app, drop a skin manager (with a skin set) and a couple buttons on it (I used TsButtons), and throw this code into them:

    CODE
    Procedure TForm1.btn1Click(Sender: TObject);
    Begin
      Form1.Position := poScreenCenter;
    End;

    Procedure TForm1.btn2Click(Sender: TObject);
    Begin
      sknmngr1.Active := (Not sknmngr1.Active);
    End;

    You can then set the skin manager to be active or not active at design time (the attached EXE has it disabled at design time) for testing.

    It was compiled under Vista 32-bit/Delphi 2007. EXE tested on both that Vista machine and on an XP machine.

    Any ideas on what I can check next?

    Thanks in advance!

    #41137
    techie007
    Participant

    Well I did find a pretty simple work-around that will do for me for this project. If I make the form invisible before issuing the reposition command, and then make it visible again, it works. With little to no artifacts so far.

    An sweet animated form repositioning system would be coolest, but that wouldn't be very easy.

    #41150
    Support
    Keymaster

    Hello
    Problem must be solved in the nearest release.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.