Forum > LCL

position problem with a dynamically created SHOWMODAL form.

(1/1)

jamie:

 When I create a dynamic MODAL form I want to have it show where my mouse just got released so the user
does not need to chase around the screen for it.

   I create the form first in code then I set the LEFT,TOP Properties to that of the MOUSE.CursorPos.....
 
   After that I do a NewForm.ShowModal ..

   Problem is the form ignores what I set after creation and just shows in the center anyways..
 
   If I set the LEFT and TOp in the OnSHow event then it works but I don't remember this being that way ?

  I am going back to my Delphi days and I thought that if you set the bounds/ left/Top properties before SHOWMODAL a
flag was set to indicate to use those settings instead of CENTER screen.

 Do I have brain fog ?

Handoko:
I don't have such issue. You can try my example code here:
http://forum.lazarus.freepascal.org/index.php/topic,37369.msg250939.html#msg250939

And this is the code I used to set the modal form's position:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  frmPopup.Top := Button1.Top + Button1.Height + Form1.Top - frmPopup.Height;  frmPopup.Left := Button1.Left + Form1.Left;  frmPopup.ShowModal;

balazsszekely:
Set the ModalForm's Position property to poDesigned? Can you attach a small test project?

jamie:
Ok, I do have the Position property set for poScreenCenter, but I thought this information is assigned during the
form.create part and then if you change the settings prior to SHowModal it should change the settings to what you want..

 This is for Windows Win32 widget, maybe there is an issue I don't kow about

P.S.
 
 Just did a test In my old D3, and it seems it is behaving this way  too, so I guess I'll need to set the Position to

poDesign instead...

 The danger is over! Thanks

Navigation

[0] Message Index

Go to full version