Jump to content

Forcing/Constraining form position


Recommended Posts


in my application I want the main form to stay in the top-left corner (Top=0 and Left=0). Then, every other form must not overlap it. So, I need some way to detect when any form position change.

This seemed to me a very basic task, but is not (or I am missing something, which is entirely possible). These are some of the events and properties I tried to manage:


Form->OnClick, Form->MouseDown/Up/Enter... don't help, because they detect only clicks/actions that happen inside the form borders, they do not trigger when the user clicks on the top bar, and therefore he is free to move the form wherever he wants.


Form->DragDrop, Form->EndDock....  they seem to work with components that are inside the form, not with the form itself. Actually, I don't know what their purpose is.


Form->Align=alTop, only works in VCL mode, and does not solve the problem with the other forms that must not overlap the main form.


Form->FormStyle=fsStayOnTop: combined with Align=Top, is a non-optimal solution, but only works in VCL mode.


So, any ideas?

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.

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...