2
votes

I have written an MDI app with many child forms, each different. Let's say that the user has created three child forms: the first form has its top left hand corner at screen coordinates 0,0; a second form has been dragged to the right hand side of the screen (coordinates 100, 300) and the third form appears at coordinates 20,20. If I use the main form's cascade command, then the second form will move to 10,10.

I would like the second form to stay where it is and get the third form to move to 10, 10 (ie second place of cascading order). Is there any way of excluding specific MDI child forms from the main form's 'Cascade' command?

1

1 Answers

3
votes

There is no way to influence the behaviour of the Cascade method which is implemented by sending a WM_MDICASCADE message to the MDI container window, ClientHandle.

Now, looking at WM_MDICASCADE it has an option to skip disabled MDI children from cascading. So you could disable certain child windows, send a WM_MDICASCADE message yourself and then re-enable the child windows. I've not attempted to do this but it seems very likely to me that it would work.

Your other option is to implement your own MDI child positioning method. This is actually relatively easy to do. I would suggest that you consult the source code for the Wine project to get an idea how to do this. The key file is mdi.c in the user32 DLL.