Problem of custom widget and sizer.
Вадим Хохлов
xvadima at ukr.net
Fri Sep 22 09:37:02 PDT 2006
Hi!
I want to use my own custom widget, which contains, for example, the wxTextCtrl and wxStatictext.
Here the constructor of this widget:
CustomWidget::CustomWidget( wxWindow *parent):
wxWindow(parent, wxID_ANY)
{
wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
topSizer->Add(new wxStaticText(this, wxID_ANY, _T("TEST")));
wxTextCtrl *ed2 = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE);
topSizer->Add(ed2, 1, wxEXPAND, 5);
SetSizer(topSizer);
topSizer->SetSizeHints(this);
} /* CustomWidget::*parent) */
And I want to insert it to sizer or splitter. But this case this custom widget draws all its children at top left
corner of window (seems topSizer don't work correctly).
Here this code:
MainFrame::MainFrame():
wxFrame(NULL, wxID_ANY, wxT("tt"))
{
wxSplitterWindow *spltr = new wxSplitterWindow(this, wxID_ANY);
CustomWidget *cw1 = new CustomWidget(spltr);
wxTextCtrl *ed2 = new wxTextCtrl(spltr, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE);
spltr->SplitHorizontally(cw1, ed2);
} /* MainFrame() */
What I do wrong?
With best wishes< Vadim A. Khohlov.
http://xvadim.chgk.info
More information about the wx-users
mailing list