wxMSW: Incorrect background on wxButtons?
Tommy W
tommy at svearike.sytes.net
Thu Apr 12 01:08:36 PDT 2007
On Wednesday 11 April 2007 23:36, Robin Dunn wrote:
> Tommy W wrote:
> >> Tommy W wrote:
> >>> Hi,
> >>> I get a default grey colour on the backgound of a wxButton when adding
> >>> it to my wxFrame.
> >>>
> >>> http://svearike.sytes.net/~tommy/login.jpg
> >>>
> >>> Is that how it is supposed to look?
> >>> Just wondering because I thought it looked a bit weird? (not used to
> >>> windows, hehe)
> >>> I'm talking about the colour 'behind' the button (in reality, the
> >>> border)
> >>
> >> Put your widgets on a wxPanel and put that panel in the Frame.
> >
> > Thanks for the tip, although I didn't get it to work.
> >
> > I did wxPanel *panel = new wxPanel(this.......
> > /* add stuff to the panel */
> > sizer->Add(panel);
> > SetSizer(panel);
> >
> > But I still get that annoying look. i.e nothing changed.
> > Did I miss something?
>
> Are you sure that you used the panel for the parent of the wxButton when
> you created it?
Quite sure actually.
wxPanel *panel = new wxPanel(this,wxID_ANY);
panel->SetBackgroundColour(GetBackgroundColour());
panel->SetForegroundColour(GetForegroundColour());
wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
wxFlexGridSizer *loginSizer = new wxFlexGridSizer(2,2,0,0);
wxStaticText *text_help = new wxStaticText(panel,wxID_ANY,_("Please enter
your username and password\nand press Login to login.\n\nIf you do not have
an account...\n$
wxStaticText *text_username = new
wxStaticText(panel,wxID_ANY,_("Username"));
wxStaticText *text_password = new
wxStaticText(panel,wxID_ANY,_("Password"));
ctrl_username = new wxTextCtrl(panel,wxID_ANY,_T("svearike"));
ctrl_password = new
wxTextCtrl(panel,wxID_ANY,_T("..."),wxDefaultPosition,wxDefaultSize,wxTE_PASSWORD);
button_login = new
wxButton(panel,LOGIN_BUTTON_ID,_("Login"),wxDefaultPosition,wxDefaultSize,wxBU_EXACTFIT);
button_login is the one that gets the ugly border.
am I missing something?
More information about the wx-users
mailing list