Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

dockable window?

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
sidjey
Asked:
sidjey
1 Solution
 
redbaron082997Commented:
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
 
sidjeyAuthor Commented:
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
 
shchukaCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
wfordCommented:
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
 
wfordCommented:
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
 
sidjeyAuthor Commented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now