How to know have we opened child dialogs

Tyushkov Nikolay wx at softvoile.com
Sun Apr 6 09:21:56 PDT 2008


> TN> Is there a way to determine has my window opened child dialogs?  
>
>  Not easily... The only thing which comes to mind is to scan
> wxTopLevelWindows list and check if there are any windows in it with your
> top frame as parent.
>   
Did you  mean something like this?

        wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
        while (node)
        {
            wxWindow* window = (wxWindow*)node->GetData();
            if (window)
            {
                 ...
            }
            node = node->GetNext();
        }

There is not much information about wxTopLevelWindows, but it seems (and 
my experiments confirm) that, wxTopLevelWindows has no information about 
native dialogs.
   
The code above returns information only about frames inherited from 
wxFrame that I create directly  (Option\About windows). But does not see 
system dialogs i.e.

    wxFileDialog dlg(this);
 or 
   m_findDialog = new wxFindReplaceDialog( this, &m_findData, _("Find"), 
wxFR_NOWHOLEWORD );


>  Alternative idea would be to store the pointer to wxEventLoop::GetActive()
> initially and compare its return value with the stored value later. At
> least under MSW it will be different while a modal dialog is shown
> (although probably not if it's a native dialog like e.g. an open file one).
>   
The same problem, it works only for wxWidgets window, does not work for 
native dialogs:(


-- 
Best regards, Nikolay Tyushkov
http://softvoile.com - Work with texts faster!



More information about the wx-users mailing list