A new widgets, composition of other widgets

M.Z. mauro.ziliani at tin.it
Fri Jan 5 23:38:33 PST 2007


On Sat, 30 Dec 2006 19:51:08 +0100, Vadim Zeitlin wrote:

> On Sat, 30 Dec 2006 12:30:27 +0000 (UTC) Mauro <mauro.ziliani at ngi.it> wrote:
> 
> M>   wxStaticText *euro = new wxStaticText(this, nid++, _T("---.--"));
> M>   box->Add(2, wxALL | wxEXPAND, 5);
> M> 
> M>   wxStaticText *sem = new wxStaticText(this, nid++, _T("R|V"));
> M>   box->Add(2, wxALL | wxEXPAND, 5);
> M> 
> M>   wxStaticText *pagato = new wxStaticText(this, nid++, _T("P"));
> M>   box->Add(1, wxALL | wxEXPAND, 5);
> M> 
> M>   wxButton *cash = new wxButton(this, nid++, _T("CASH"));
> M>   box->Add(2, wxALL | wxEXPAND, 5);
> M> 
> M>   wxStaticText *connect = new wxStaticText(this, nid++, _T("C|NC"));
> M>   box->Add(1, wxALL | wxEXPAND, 5);
> 
>  It's really unfortunate that the above code compilers because this is
> absolutely not what you wanted to do: notice that you didn't add any of the
> controls created above to the sizer.
> 
>  Regards,
> VZ
>


Ahhh....
This is true.

I copy the wrong version of the example.
But I have understand the matter.
When I make a widget composed by others widgets I need to ovverride OnSize
event whit a function like this.

...
EVT_SIZE(Display::OnSize)
...

void Display::OnSize(wxSizeEvent& evet)
{
 Layout();
}


This is written in the docs... :-)
I didn't read carefully. :-(

Thanks for your answer.

Mauro






More information about the wx-users mailing list