Pelles C forum

C language => Windows questions => Topic started by: nancy on December 18, 2012, 08:43:26 PM

Title: MDI close button
Post by: nancy on December 18, 2012, 08:43:26 PM
Hallo,

I have the following problem: I have a MDI application. If  I maximize one of the child windows there should be a second set of minimize/restore/close buttons at the menu strip. But there isn't. 
Title: Re: MDI close button
Post by: CommonTater on December 18, 2012, 10:18:25 PM
Check your window styles on the MDI Children... are you creating them with the buttons?
Title: Re: MDI close button
Post by: nancy on December 18, 2012, 10:35:23 PM
The childs are build via the MDICREATESTRUCT. The style parameter is MDIS_ALLCHILDSTYLES.
Title: Re: MDI close button
Post by: CommonTater on December 18, 2012, 10:59:51 PM
OK... I'll step out and let someone else take a try at this one...

Title: Re: MDI close button
Post by: Stefan Pendl on December 19, 2012, 03:05:59 PM
Have you tried duplicating this with a simple test window allowing you to add MDI childes?

May be attach the project, so we can all work from the same source.
Title: Re: MDI close button
Post by: czerny on December 20, 2012, 08:08:09 AM
There are two examples 'MDIDlgs' and 'MidiDialogs2' at Christians site. The former lacks in the buttons. The later not. Unfortunately I can not find the relavant part.
Title: Re: MDI close button
Post by: frankie on December 20, 2012, 09:54:56 AM
Have looked for code on John site?
http://www.johnfindlay.plus.com/ (http://www.johnfindlay.plus.com/)
Title: Re: MDI close button
Post by: JohnF on December 21, 2012, 09:00:21 AM
There is an MDI Wizard in the Wizards section on my web site.

John
Title: Re: MDI close button
Post by: nancy on December 21, 2012, 09:58:47 PM
Thank you all!

But I do not want to start from scratch. Any hint?
Title: Re: MDI close button
Post by: CommonTater on December 21, 2012, 10:28:28 PM
Thank you all!

But I do not want to start from scratch. Any hint?

There's no reason to do that, Nancy.... 

Something I do a lot when working on difficult code is to write a small "side program" to test certain things so I can understand how they work without messing up my main project.  For example ... I recently did some coding with a tree view control, but was having a bit of trouble getting stored data pointers back from it's LPARAM storage... so I wrote a small side program that I could afford to messup as royally as I needed to and stayed with it until I got it working... then I simply took the working solution and transplanted it into my main project.
 
Programmers do stuff like that all the time.  Some of my very best code is stored away in projects named test1, test2, mumble and glorp...
 
Title: Re: MDI close button
Post by: Stefan Pendl on December 22, 2012, 01:30:23 PM
Some of my very best code is stored away in projects named test1, test2, mumble and glorp...

Oh yes, these projects are the best 8)

Always do some prototyping for complex sections and you will see how they get really simple ;)
Title: Re: MDI close button
Post by: nancy on December 22, 2012, 01:59:41 PM
Ok, I have installed Johns MDI-Wizard and created a new project.

But there are different problems with this code.
There should be a default child window at startup. But either it is not shown at all or it is vanishing at certain positions if I try to size it horizontally. The statusbar is not update correctly too.
I am not sure if it is ok to create a mdi child via CreateWindowEx. The MS docu recommends the creation via the MDICREATESTRUCT.
Title: Re: MDI close button
Post by: JohnF on December 22, 2012, 04:18:31 PM
The Wizard used to work ok in previous versions of PellesC, there is obviously a problem with the latest version, will try to find time to fix it.

EDIT: The Wizard code works if one turns off the compiler optimization.

NOTE: As a general rule I don't use the compiler optimization - it seldom speeds things up but more importantly one never can be sure it will not create problems.

John
Title: Re: MDI close button
Post by: TimoVJL on December 22, 2012, 08:58:32 PM
But I do not want to start from scratch. Any hint?
Does your MDI child code handle WM_SIZE message correctly?
I mean forward to DefMDIChildProc() too ?
Title: Re: MDI close button
Post by: nancy on December 23, 2012, 05:03:43 PM
Does your MDI child code handle WM_SIZE message correctly?
I mean forward to DefMDIChildProc() too ?

No! I am ashamed of myself! Thank you very much!
Title: Re: MDI close button
Post by: CommonTater on December 23, 2012, 08:19:42 PM
No! I am ashamed of myself! Thank you very much!

Really?  It qualifies under "I didn't know"... which is never anything to be ashamed of.