Jump to content

where is the right place to read mainform.Width at start ?


erich.wanker

Recommended Posts

hello ..
i need the mainform.Width to adjuste a form at start (uniForm2.position= default)
 
procedure TMainForm.UniFormShow(Sender: TObject);
begin
   uniform2.left:=trunc((mainform.Width/2)-(uniForm2.Width/2 - 45));
   uniform2.ShowModal;
end;

 

  -->   read mainform.Width at this point brings the pixel-width of delphi-designtime ..

 

ThanX for suggestions

 

Erich

 

Link to comment
Share on other sites

Hi Erich.

If I understand correctly, try:

UniForm1 ... ->

function window.beforeshow(sender, eOpts)
{
  //UniForm1.left := ...
  //this.setPosition(1000);
  this.setPosition(Math.round(MainForm.form.width / 2) - Math.round(this.width / 2) );
}

Best regards.

Link to comment
Share on other sites

Hi Delphi Developer,

thank you for your help :-) 

but it didn´t work - the UniForm.left value is zero at this time

 

i made a little "workarround" :

procedure TMainForm.UniFormShow(Sender: TObject);
begin
UniTimer1.Enabled:=true;
end;
procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
 uniform2.left:=trunc((mainform.Width/2)-(uniForm2.Width/2));
 uniform2.ShowModal;
end;

.. in this case i can read the right mainform.Width-value ... that works for me :-)

 

ThanX and nice greetings from Austria

 

Erich

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...