nanogui: focuswp and MwDestroyWindow
Subject:
Re: [nanogui] focuswp and MwDestroyWindow
From:
"MrWGT" ####@####.####
Date:
25 Oct 2004 21:10:25 +0100
Message-Id: <200410252010.i9PKALXQ028414@post.webmailer.de>
Hi...
i came across the same problem some month ago. I solved it that way (maybe not the best solution but up to now it works):
old source:
/*
* Destroy all children, sending WM_DESTROY messages.
*/
while (wp->children)
MwDestroyWindow(wp->children, bSendMsg);
new source:
/*
* Destroy all children, sending WM_DESTROY messages.
*/
while (wp->children)
{
if (wp->children == focuswp)
focuswp = MwGetTopWindow(focuswp);
MwDestroyWindow(wp->children, bSendMsg);
}
>so for a win 32 implemented code we had to apply a check for the same in
>MwDestroyWindow.
><snip>
>//additional 2 lines follow
>% if(wp == focuswp)
>% SetFocus(rootwp->children? rootwp->children: rootwp);
>if(wp == MwGetTopWindow(focuswp))
>SetFocus(rootwp->children? rootwp->children: rootwp);
I think that your solution to set/correct the focuswp just before the original code should work. But i would focus the parent if there's one instead of the rootwp or
the first child.
// 1) New: If wp is focused set focus to parent (if wp is child)
if (wp == focuswp)
SetFocus(MwGetTopWindow(focuswp));
// 2) Original: If wp is parent of focuswp set focus to other rootwp or first child of rootwp
if (wp == MwGetTopWindow(focuswp))
SetFocus(rootwp->children? rootwp->children: rootwp);
Kind regards,
Gerd