A new widgets, composition of other widgets
Mauro
mauro.ziliani at ngi.it
Sat Dec 30 04:30:27 PST 2006
Hi all.
I'm writing an apllication where I need to make a new widget made by a
composition of other standard widgets.
This is the constructor.
Display::Display(wxWindow *parent, wxWindowID id, int num,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
: wxPanel(parent, id, pos,size, style, name)
{
wxBoxSizer *box = new wxBoxSizer(wxHORIZONTAL);
SetSizer(box);
int nid = 100;
wxString n;
n.Printf(_T("%02d"), num);
wxStaticText *nerog = new wxStaticText(this, nid++, n,
wxDefaultPosition, wxSize(100,-1),
wxSIMPLE_BORDER | wxST_NO_AUTORESIZE);
box->Add(nerog, 1, wxALL | wxEXPAND, 5);
wxStaticText * kg = new wxStaticText(this, nid++, _T("---.--"));
box->Add(kg, 2, wxALL | wxEXPAND, 5);
wxStaticText *euro = new wxStaticText(this, nid++, _T("---.--"));
box->Add(2, wxALL | wxEXPAND, 5);
wxStaticText *sem = new wxStaticText(this, nid++, _T("R|V"));
box->Add(2, wxALL | wxEXPAND, 5);
wxStaticText *pagato = new wxStaticText(this, nid++, _T("P"));
box->Add(1, wxALL | wxEXPAND, 5);
wxButton *cash = new wxButton(this, nid++, _T("CASH"));
box->Add(2, wxALL | wxEXPAND, 5);
wxStaticText *connect = new wxStaticText(this, nid++, _T("C|NC"));
box->Add(1, wxALL | wxEXPAND, 5);
box->Layout();
}
The strange behavior is that all widgets is in the same position, not one
on-the-right of the other.
Why?
Mauro
More information about the wx-users
mailing list