I' don't have any clues how to do it.

1) If the user pop-up a new window (child) I want to glue the child window to the main window.

2) If the child windows is moved near the main window (say 20 or 30 pixels) it will automaticaly glue to the main window.

Does someone now what are the API's I have to use ?

Thank you very much !

Regards, Neitsa.
Posted on 2004-03-25 06:37:18 by Neitsa
Hello Neitsa
This feature was shown in Demo08 of the ObjAsm32 package. It was developed for MdiChilds but can be extended to any type of window. The requested behavior was implemented in the magnetism object. Take a look at it.

Hope it helps :)


Posted on 2004-03-25 07:21:58 by Biterider
You can also just process the WM_WINDOWPOSCHANGING message. One of my current projects use an autodock type thing, this is the code for it snipped out. If the child window moves within 10 pixels of the left or right edge of main it will be aligned automatically.
Posted on 2004-03-25 10:02:44 by donkey
Thanx for your answers Biterider and Donkey.

I'll study both example.

Donkey, thank you very much for sharing your source code !

Regards, Neitsa.
Posted on 2004-03-25 11:15:49 by Neitsa
Hi Donkey,

There's a small bug in the code of the child window: when the child window is docked, and when the top side of the child window is "grabbed" with the mouse to change the height, then the resize of the child window happens in reverse order.

Normally, when you move the mouse to the top of the screen the window should grow larger, but in your case it's the other way around.

When the child window is undocked the resizing is normal again.

Posted on 2004-03-25 12:02:23 by Apprentice
That's not a bug really, as I said it was snipped from my code. In my program the size of the window is fixed. You can remove the top alignment to stop the behavior. It is because the window is resized and then because it is docked the tops are aligned.

Remove these lines from the docks
mov eax,[prect.top]

mov [edi+WINDOWPOS.y],eax
Posted on 2004-03-25 12:23:28 by donkey