Link to home
Start Free TrialLog in
Avatar of oldbie
oldbie

asked on

Docking forms beneath the main form

I have an app with a main form and about 6 sub forms (for setting comm parameters and the like), which can be open or closed by the user's. When they are opened (by a button on the main form), I have it set up so they are the same width as the main, and abutting it at the bottom. That was easy, but when the user moves the main form, how can I make the other forms "tag along"? I thought a combination of mouseDown and mouseMove would do it, but those events aren't generated when dragging the form by the title bar. So what events *are* fired when moving a form?
Avatar of BennyBunny
BennyBunny

Maybe u should make the "mainform" an mdiform and the others mdichilds og this form i guess then they are moving with the parent window
Avatar of oldbie

ASKER

This would work, but MDI is not appropriate for this app. A major design goal is to keep the windows as small as possible to leave room for the other apps that will be running. (It's a robotic telescope system with a lot going on at once.) So the idea is to keep the (small) main window open, and open and close sub-windows as needed.
Do want an "elegant" answer or a fast and workable answer?
ASKER CERTIFIED SOLUTION
Avatar of freelnce
freelnce

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of oldbie

ASKER

This works!

I guess the elegant answer involves an API call to hook into the window messages, right?
You got it.  You would have to subclass the form and intercept the windows move message that accompanies the repositioning of a form.  It is more "elegant" but is also more work and more apt cause errors in the app if an API call is improperly made.

Glad it worked for you.  you might also want to consider placing code to align the secondary forms to the main form if the bottom of the main form is positoined off screen.