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?
oldbieAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BennyBunnyCommented:
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
0
oldbieAuthor Commented:
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.
0
freelnceCommented:
Do want an "elegant" answer or a fast and workable answer?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

freelnceCommented:
Here is a fast but workable answer to your question.  

First place a timer control on your main form and then add the following to the timer event: (adjust the form names and positioning to fit your needs)

Private Sub Timer1_Timer()
  Form2.Move (Me.Left, Me.Top + Me.Height), Form2.Width, Form2.Height
  Form3.Move (Form2.Left + Form2.Width), Form2.Top, Form3.Width,      Form3.Height
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oldbieAuthor Commented:
This works!

I guess the elegant answer involves an API call to hook into the window messages, right?
0
freelnceCommented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.