Solved

dockable window?

Posted on 1998-08-29
6
246 Views
Last Modified: 2011-09-20
Hello,
I would like to create a dockable window like in visual basic environnement. How can I do this?
I've two forms load (form1 and form2).(Form2.left=form1.left+form1.width and form2.top=form1.top)
Thanks a lot
Nathalie
0
Comment
Question by:sidjey
6 Comments
 
LVL 1

Expert Comment

by:redbaron082997
Comment Utility
Test for positioning of form1 relative to form2. If it is within the HOT area (Form2.left <= (form1.left+form1.width+HOTAREA) ) then snap it to posisition. That would give look and feel. You would want to test for this on mousemove events, or buttonup events. If you need more, let me know, but this should do it for you.
0
 

Author Comment

by:sidjey
Comment Utility
I know that, but it isn't exactly that i would like to do. I would like that my form2 become "dockable" to my form1 and the left 3d borders (form2) and the right 3 borders (form1) disappear (try to move a toolbar in vbIDE and "attach" to another toolbar, you'll seen that i want to do). Do you know how can I do this?
Sorry for my english.
0
 
LVL 2

Accepted Solution

by:
shchuka earned 30 total points
Comment Utility
You can use a panel on you form 1 with align property set to whatever you need (normally top or left).  You can have this panel filled with whatever is on your form2.  I.e. your form2 contains this panel only and it contains all the controls.

When you're snapping it to form1, use SetParent API to put this panel onto form1 and hide the form2.

Use standard drag-and-drop to "unsnap" the panel and SetParent it back onto the form2.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:wford
Comment Utility
This is done in a MDI form enviroment, You need to set things up as redbaron said, then you need some controlarray panels, you set these panels at the dock sized for the form, then place the form on the top of the panel, the panel then becomes the controls the resize events with the form, or draging the panel sides.  The form has to be changed to (I belive) a flat border toolbar MDI child, , which needs an API call:
SetWindowLong(hWnd&, GWL_STYLE, value&)
, since the VB property is read only. I am a little unsure about how to do this final bit, which is sort of the whole point of the operation. So, I'll leave this as a comment until I have got it working, or someone else posts the solution, meanwhile, good hunting


0
 
LVL 1

Expert Comment

by:wford
Comment Utility
Woop, sorry Shchuka, I didn't refresh, Still there is a problem with this, you will loose the toolbar at the top of the form, still, a simpler and neater solution.
0
 

Author Comment

by:sidjey
Comment Utility
Thanks a lot. But how can I use standard drag-and-drop to "unsnap" the panel and SetParent it back onto the form2 ?

Nathalie
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now