wxFrame and wxWindow Question

304 views
Skip to first unread message

Matthew Kettlewell

unread,
Dec 14, 2002, 12:17:32 AM12/14/02
to wx-u...@lists.wxwindows.org

Hi All,

I'm trying to get a firm notion of what the different roles of a wxFrame
and a wxWindow are. I understand them in vague terms, but not in a
concrete way. Could someone briefly explain to me what they are and what
their roles are. Also, the types of methods that I can expect to place in
each of them would be helpful. If there is a document that explains all
of this, a pointer to that would be great.

Cheers!!

Matt

Vadim Zeitlin

unread,
Dec 14, 2002, 6:51:51 AM12/14/02
to wx-u...@lists.wxwindows.org
On Sat, 14 Dec 2002 05:17:32 GMT Matthew Kettlewell <ma...@kettlewell.net> wrote:

MK> I'm trying to get a firm notion of what the different roles of a wxFrame
MK> and a wxWindow are.

Any window shown on screen is a wxWindow. In particular, wxFrame is a
wxWindow too -- but it's a top level window. Each program has at least one
top level window (i.e. a wxFrame or maybe wxDialog) which usually contains
several windows inside it.

Regards,
VZ


David C. Fox

unread,
Dec 14, 2002, 9:12:34 AM12/14/02
to wx-u...@lists.wxwindows.org
Matthew Kettlewell wrote:

Also, controls like buttons, text controls, etc., which you might not
think of as separate windows, are in fact derived from wxWindow.

David


Tony McGee

unread,
Dec 15, 2002, 12:41:44 AM12/15/02
to wx-u...@lists.wxwindows.org

The right place to put things is a design issue and it comes down to ease of
maintainability and level of flexibility you want your program to have.
When you create a frame window (wxFrame) you can create child windows that
derive from wxWindow and place them inside the frame. It's usually better to
break the program up this way rather than do painting directly to a frame
window which makes your code difficult to modify or extend.

There is a clear distinction between a frame window and any window which is
explained in more detail in the wxWindows documentation.
http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/docs/wxwin165.htm#wxframe
http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/docs/wxwin413.htm#wxwindow
The basic distinction is that every text field, button, menu, status bar,
toolbar, and even every frame you create is a wxWindow (derived from the
wxWindow class in C++ terms). However wxFrame is derived to serve a specific
purpose - that is to act as a top level application window. This means that
everything you can do with a wxWindow, you can do with a wxFrame and more.

So the answer to your question about where to put functionality is that it's
up to you as the application programmer. You can probably get it to work in
a variety of ways but be aware that some designs are better than others.

----- Original Message -----
From: "Matthew Kettlewell" <ma...@kettlewell.net>
Newsgroups: comp.soft-sys.wxwindows
To: <wx-u...@lists.wxwindows.org>
Sent: Sunday, December 15, 2002 12:13 PM
Subject: Re: wxFrame and wxWindow Question


>
> OK, I'm starting to catch on. But I guess what my quandry is, is where the
> *right* place is to put things. I see many things that are going into a
> derived wxFrame and others into a derived wxWindow , while in a separate
> program they may switch where it gets placed.
>
> I notice that onPaint() and its kiln get placed in a derived wxWindow, but
> I don't understand why it can't go into a derived wxFrame. or can it?
>
> Maybe I just don't know what is intended as a definition for Window vs
> Frame. I've been looking through the wxWindows source, but I am still
> short on the difference.
>
> Sorry for the rambling, but sometimes explaining things in a few different
> ways can get my question out.
>
> Thanks
>
> Matt


>
>
>
> > Any window shown on screen is a wxWindow. In particular, wxFrame is a
> > wxWindow too -- but it's a top level window. Each program has at least
one
> > top level window (i.e. a wxFrame or maybe wxDialog) which usually
contains
> > several windows inside it.
> >
> > Regards,
> > VZ
> >
>
>
>
>

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-u...@lists.wxwindows.org
> For additional commands, e-mail: wx-use...@lists.wxwindows.org
>


Reply all
Reply to author
Forward
0 new messages