[ wxwindows-Feature Requests-1897874 ] Multiple Main Frames

SourceForge.net noreply at sourceforge.net
Mon Mar 3 02:14:43 PST 2008


Feature Requests item #1897874, was opened at 2008-02-20 15:13
Message generated for change (Comment added) made by keinstein
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=359863&aid=1897874&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Open
Priority: 5
Private: No
Submitted By: Tobias Schlemmer (keinstein)
Assigned to: Nobody/Anonymous (nobody)
Summary: Multiple Main Frames

Initial Comment:
I'd like to have support for multiple Top level frames. It seems to be common among several well known applications (Office programs, Web browsers etc.) to have  no explicit visible main frame.

Hidden frames are not a very elegant solution on most systems.

The frames could be registered in some container and switched if needed. The Application could exit when the last frame is removed (or not if it is Mac OS X).


----------------------------------------------------------------------

>Comment By: Tobias Schlemmer (keinstein)
Date: 2008-03-03 11:14

Message:
Logged In: YES 
user_id=831067
Originator: YES

Documentation for wxTopLevelWindow:

Add a Paragraph after
---------------
wxTopLevelWindow

wxTopLevelWindow is a common base class for wxDialog and wxFrame. It is an
abstract base class meaning that you never work with objects of this class
directly, but all of its methods are also applicable for the two classes
above.
---------------
stating
---------------
The instances of wxTopLevelWindow are managed by wxWidgets in the internal
top level window list.
---------------
If this is not save enough, include the virtual functions managing this
beaviour in the documentation.



wxApp::SetTopWindow():

Change the paragraph to
------
Sets the 'top' window. You can call this from within wxApp::OnInit to let
wxWidgets know which is the main window. You don't have to set the top
window; it is only a convenience so that (for example) certain dialogs
without parents can use a specific window as the top window.
If no top window is specified by the application, wxWidgets just uses the
first frame or dialog in its top-level window list, when it needs to use
the top window.
------
to
------
Sets the 'top' window. You can call this from within wxApp::OnInit _or
elsewhere_ to let wxWidgets know which is the main window. You don't have
to set the _main_ window; it is only a convenience so that (for example)
certain dialogs without parents can use a specific window as the top window
_instead_.
If no top window is specified by the application, wxWidgets just uses the
first frame or dialog  _(or instance of wxTopLevelWindow)_ in its
_internal_ top-level window list, when it needs to use the top window. _You
can restore this automatic behaviour by calling
wxApp::SetTopWindow(NULL)._
----------

wxApp::GetTopWindow():

change 
------------------
Remarks

If the top window hasn't been set using wxApp::SetTopWindow, this function
will find the first top-level window (frame or dialog) and return that.
------------------
to
------------------
Remarks

If the top window hasn't been set using wxApp::SetTopWindow, this function
will find the first top-level window (frame or dialog or instance of
wxTopLevelWindow) from the internal list and return that.
------------------

Btw.: somtimes it would be useful to have an easy way to cycle through all
windows (e.g. for sending events or updating something).

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2008-02-20 17:27

Message:
Logged In: YES 
user_id=71618
Originator: NO

I'm sorry but I still have no idea about what exactly is not documented
and correct description of what exactly is missing. At this point ideal
would be really if you could just provide the text you'd like to see added
to the manual and indicate where you'd like to see it appear.

Thanks!

----------------------------------------------------------------------

Comment By: Tobias Schlemmer (keinstein)
Date: 2008-02-20 17:19

Message:
Logged In: YES 
user_id=831067
Originator: YES

Thanks for your explanation. The documentation is misleading.

In my last message I suggested to include a correct description in the
documentation of wx. I intentionally didn't mention wxTopLevelWindows. But
if I would have known about it I would have saved much time.

I dislike to use undocumented features without checking the manual.
Exspecially but not only when difference is between "need not" and "must
not".

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2008-02-20 16:55

Message:
Logged In: YES 
user_id=71618
Originator: NO

I think you're confusing the discussion about the MDI applications with
the normal applications. The hidden frame is used for MDI but there is no
need for it if you don't use MDI -- and it doesn't seem like you need to do
it. SetTopWindow() doesn't need to be called, nor do you need to use
wxTopLevelWindows list.

Just create your frames as you'd normally would, the application will exit
when the last one is closed without having anything special to do about it.
As for the sample, please feel free to record your experiences in the wiki
and/or ask for advice on wx-users but I really don't see anything special
to be said about this so I'm closing this request as I don't see what
exactly do you expect us to do.

----------------------------------------------------------------------

Comment By: Tobias Schlemmer (keinstein)
Date: 2008-02-20 16:50

Message:
Logged In: YES 
user_id=831067
Originator: YES

Thanks for the quick answer.

The problem is that I couldn't find any documentation about it and the
search engine of my choice showed up only such tutorials that suggest to
use a hidden window on Mac OS X.

The documentation about wxApp::SetTopWindow and wxApp::GetTopWindow tells
something about a top level window list, but doesn't tell, how it is
managed.

Maybe it would help to mention wxTopLevelWindow there and the top level
window list in the description of wxTopLevelWindow.

Another useful fact is, that wxApp::SetTopWindow must not be used in a
application with multiple toplevel windows.

And it would be nice to have a small sample showing that it works.

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2008-02-20 15:32

Message:
Logged In: YES 
user_id=71618
Originator: NO

Sorry what's exactly the problem with having multiple TLWs? AFAIK this
works just fine (and always did).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=359863&aid=1897874&group_id=9863




More information about the wx-dev mailing list