I've searched the board for examples and there was plenty of them, but not for this specific issue. I have a dialog as main window in my program and want to make child windows. But when I set the WS_CHILD and invoke CreateDialogParam and the child dialog shows up, but it's screwed up. It never gets focus and when I try to maximize it appears over my toolbar. How can I fix this strange behaviour? Any ideas appreciated!



/siddhartha
Posted on 2004-08-18 23:17:50 by siddhartha
can you give some more information? What means "screwed up" - can you add a screenshot? I think, creating childs for a dialog should work proper. You have set WS_CHILD - to which window? Do you create a child window (this would mean CreateWindowEx) or another child dialog (you wrote CreateDialogParam)?
Posted on 2004-08-25 05:05:55 by beaster
I mean that the child never gets focus and is positioned over my toolbar. I set the child WS_CHILD. And, no, I don't create child window with CreateWindowEx, because I want to load it from resource, which as far as I know is done with CreateDialogParam. I can't send the source because I accidentally deleted it. I'll try to reproduce it once again, but any suggestions or examples are welcome!



/siddhartha
Posted on 2004-08-25 05:34:02 by siddhartha
OK. Here's a fast example of the situation:
Posted on 2004-08-25 05:42:25 by siddhartha
And here is the example with toolbar, where everything is totally screwed...
Posted on 2004-08-25 07:00:22 by siddhartha
I think the problem is the toolbar as a child window of the dialog. I have no idea if this is possible at all. You likely will need to ensure on your own, that the user cannot move any child over the toolbar area.

You can also try to add the WS_CLIPSIBLINGS and WS_CLIPCHILDREN style to main and dialog and its controls and to the child dialog. I could not see if you have this already, cause you have the window styles hard coded as hex values.
Posted on 2004-08-25 12:19:46 by beaster
It neither works. I think I should create a frame window representing the client area and where all the children will be placed. Or it would be better if I can change the main window's client area... Suggestions, suggestions, suggestions...



/siddhartha
Posted on 2004-08-26 04:05:18 by siddhartha
It's perfectly possibly AFAIK to have a toolbat as a child of any other window. The issue is probably in the style bits, but I don't know which ones you're using because they're hardcoded in hex...

My two cents: remove any WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles from all windows and controls, and make sure that only controls have the WS_CHILD style, all the others should have either WS_POPUP or WS_OVERLAPPED. It's a bit "voodoo programming" but it might work ;)
Posted on 2004-08-26 16:48:39 by QvasiModo
QvasiModo, thanks for the tip, but it neither works. You maybe got me wrong on this point - I don't want to make my toolbar child of the main dialog, but to make another dialog child of the main. If you've downloaded the example you would have got the idea. It would be better if you have an example mdi application with child windows created from resources, so I can find it out on my own.



/siddhartha
Posted on 2004-08-27 09:07:46 by siddhartha
QvasiModo, thanks for the tip, but it neither works. You maybe got me wrong on this point - I don't want to make my toolbar child of the main dialog, but to make another dialog child of the main. If you've downloaded the example you would have got the idea.


Sorry, dumb me :oops: *slap in the forehead*

It would be better if you have an example mdi application with child windows created from resources, so I can find it out on my own.


I'll try to come up with a sample and post it here. :)
Posted on 2004-08-27 16:44:59 by QvasiModo
Hey, don't blame yourself - errare humanum est! So if you've got some time to investigate my case and write an example I'll be so greatful! Thanks for the understanding!


/siddhartha
Posted on 2004-08-27 17:26:45 by siddhartha