I have several child windows, all with the same parent. I want to cascade/tile these windows and was happy to find the TileWindows and CascadeWindows functions. But they don't seem to work on my windows if they don't have a caption (and they don't have one)! With caption everything is fine. Why is this?
+1
A:
Those are functions that were designed to work with MDI child windows. An MDI child window must have a caption. If they work with non-MDI child windows too (haven't tried) then surely Windows avoids moving a window that cannot easily be moved back by the user.
Hans Passant
2010-03-29 22:19:44
You mean like Windows is afraid of accidentally moving a window out of the user's reach?
Heinrich Ulbricht
2010-03-29 22:59:11
If a window doesn't have a caption then a user doesn't have an easy way to move the window.
Hans Passant
2010-03-29 23:42:22
Well I assume I have to live with this fact :-/
Heinrich Ulbricht
2010-04-01 08:41:25
A:
Windows allows to tile / cascade windows only if the wsCaption flag of a window is set. This has to do with the original purpose, namely that these functions are mainly used in MDI applications. In addition these functions can also be used on a set of top level windows (right clicking on the task bar gives you respective menu entries) which typically have a titlebar.
iamjoosy
2010-03-29 22:49:24
But why isn't anything of this mentioned in the documentation? I find this a rather hard restriction - especially if you have to stumble over it to learn it.
Heinrich Ulbricht
2010-03-29 22:57:37
Maybe because MS thaught that noone would ever want to tile/cascade captionless windows as this functionality is closely tight to MDI. Remember in MDI these functions do more than just arrange the windows - e.g. the caption of a child window becomes the caption of the main window when it is maximized. In addition it looses its own caption.
iamjoosy
2010-03-29 23:03:52