[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Switching between wxNotebook and wxListbook
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] Switching between wxNotebook and wxListbook |
Date: |
Thu, 20 Jul 2006 04:22:58 +0200 |
On Thu, 20 Jul 2006 00:24:25 +0000 Greg Chicares <address@hidden> wrote:
GC> 1. Two simple text replacements:
GC> s/wxNotebook/wxBookCtrlBase/g
GC> s/#include <wx/notebook.h>/#include <wx/bookctrl.h>/
GC> across all my '*.?pp' files were nearly sufficient. The only problem
GC> I encountered was that there is no
GC> typedef wxWindow wxBookCtrlBasePage;
GC> corresponding to wxNotebookPage.
You can just use wxWindow instead of wxNotebookPage. I initially thought
that there could be some restrictions on the notebook pages (e.g. that only
wxPanel could be used) but this turned out to not be the case so this
typedef is not very useful.
GC> However, it seems strange to use an
GC> undocumented wx base class directly--I'd avoid using wxWindowBase,
GC> for example. Is it a bad idea to use wxBookCtrlBase in user code?
No, it isn't. It's true that you normally wouldn't use wxWindowBase but
this is because it doesn't make much sense as all objects of this class
derive from wxWindow too anyhow. In wxBookCtrlBase case there are quite a
few classes deriving from it so using it is perfectly reasonable.
GC> Of course, wxBookCtrl isn't the right way: it's a macro for a derived
GC> class, not a common base class.
Indeed. wxBookCtrl stands for "the most natural book-like control for the
current platform". So it is useful as well but it does take the name which
could have been used by wxBookCtrlBase and so we have no choice but to use
wxBookCtrlBase for the base class.
GC> 2. In an '.xrc' file, I had to change
GC> s/class="wxNotebook"/class="wxListbook"/
GC> as expected, but I also had to change
GC> s/class="notebookpage"/class="listbookpage"/
GC> which seems inconvenient. Shouldn't there be a 'class' that works
GC> for both? I tried 'class="wxWindow"', but that didn't work at all.
Indeed, currently you have to use notebookpage/listbookpage/treebookpage/
choicebookpage. But it does make sense to use a single bookctrlpage to me,
so I'll ask on wx-dev about it and add support for this if there are no
objections.
GC> 3. BTW, I notice that I've got this line
GC> <usenotebooksizer>1</usenotebooksizer>
GC> in the '.xrc' file. As with 'class="notebookpage"', I imagine that
GC> I just copied this from some wx example years ago; does it actually
GC> do anything? I don't observe any difference in program behavior if
GC> I remove this line.
No, this is obsolete and you can safely remove it.
GC> 4. The wxListCtrl doesn't seem to size itself automatically to make
GC> its contents fit, even if I widen the dialog. I'll email you a tiny
GC> '.png' that shows this. I thought this might be a wxSplitterWindow
GC> but couldn't find a "sash" to drag. Shouldn't wxxrc resize this?
The list control currently doesn't resize after creation. I did think
about using a splitter here but didn't do it for several reasons, the most
important one being that it should work just fine without it anyhow, as the
control should have correct size initially. But clearly this is not the
case here... Could you please let me know how can I reproduce the bug? I
don't see it in the notebook sample.
Thanks!
VZ