Hi,

I'm creating a game dev kit where I need to switch between MDI and SDI mode.
MDI is used when displaying the IDE with editors etc, in SDI mode only the
"game" window is displayed, optionally with a few editors remaining open.

However, setting MdiParent once the child windows has been Shown() causes
strange refresh and focusing problems, e.g. a child window will not receive
focus when clicking on anything else than the title bar or resize borders.
It's very easy to recreate the problem; I can post the code if necessary.

I don't want to Close() the forms and re-open them, because there's a lot of
complex data in them that I don't want to have to serialize for loading at
re-load time.

Can I do anything about this?

Re: Dynamic MDI problems by Bryan

Bryan
Fri Oct 27 17:11:23 CDT 2006

Post the code and I'll take a look.

Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com




"Jonas Beckeman" <JonasBeckeman@discussions.microsoft.com> wrote in
message news:B13A82D6-B471-42DF-9285-57CA6D5B1A7E@microsoft.com:

> Hi,
>
> I'm creating a game dev kit where I need to switch between MDI and SDI mode.
> MDI is used when displaying the IDE with editors etc, in SDI mode only the
> "game" window is displayed, optionally with a few editors remaining open.
>
> However, setting MdiParent once the child windows has been Shown() causes
> strange refresh and focusing problems, e.g. a child window will not receive
> focus when clicking on anything else than the title bar or resize borders.
> It's very easy to recreate the problem; I can post the code if necessary.
>
> I don't want to Close() the forms and re-open them, because there's a lot of
> complex data in them that I don't want to have to serialize for loading at
> re-load time.
>
> Can I do anything about this?


Re: Dynamic MDI problems by JonasBeckeman

JonasBeckeman
Sat Oct 28 04:47:02 CDT 2006

Thanks, but I found a solution, or hack rather, but it works:

protected override void WndProc(ref Message m)
{
if (m.Msg == 33)
this.Activate();
base.WndProc(ref m);
}

Overall, I spend so much time fighting WinForms quirks that I'm considering
switching to wxWidgets or even Flash. Or WPF if it gets good penetration
quickly, I really hope so.

"Bryan Phillips" wrote:

> Post the code and I'll take a look.
>
> Bryan Phillips
> MCSD, MCDBA, MCSE
> Blog: http://bphillips76.spaces.live.com

Re: Dynamic MDI problems by JonasBeckeman

JonasBeckeman
Sat Oct 28 04:54:01 CDT 2006

Thanks, but I found a solution, or hack rather, that works:
protected override void WndProc(ref Message m)
{
if (m.Msg == 33)
this.Activate();
base.WndProc(ref m);
}
I created a base class and inherit all my forms from there. Very ugly... It
really gets to me, all the time I'm spending on fighting WinForms quirks.
Hope WPF gets good penetration soon, so I can concentrate on my programs'
features instead of hair-pulling...


"Bryan Phillips" wrote:

> Post the code and I'll take a look.
>
> Bryan Phillips
> MCSD, MCDBA, MCSE
> Blog: http://bphillips76.spaces.live.com