erich.wanker Posted October 16, 2014 Share Posted October 16, 2014 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 More sharing options...
Sherzod Posted October 16, 2014 Share Posted October 16, 2014 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 More sharing options...
erich.wanker Posted October 16, 2014 Author Share Posted October 16, 2014 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 More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now