I wonder how can I loop through all wxFrames and wxDialogs in my application?
I want to do this in order to find windows by their (base) class type and when the window is found possible also examine some of its public properties. Eg. figure out if a property window for a certain object is open or not.
Can I perhaps access some container that can be used to iterate over all top level windows? (I've tried to search the API + google but have not found anything)
Edit: I'm using wxWidgets 2.9.2
Loop through all wxFrames (and wxDialogs)? Topic is solved
Re: Loop through all wxFrames (and wxDialogs)?
There is no API for it, but there is a global variable "wxTopLevelWindows" which is a list that contains the pointers to all wxTopLevelWindows.
Code: Select all
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow* win = node->GetData();
// do something with "win"
node = node->GetNext();
}
Use the source, Luke!
Re: Loop through all wxFrames (and wxDialogs)?
Thank you, that solved my problem. Now I can implement my own way of finding top level windows of a certain kind.