i have to change the color of the radio buttons label in a wxRadioBox, but can only change the color of the wxRadioBox description. How can I do?
I ve tried the following code, but it does not work :
Code: Select all
_toolbar->SetBackgroundColour(*wxBLACK);
_toolbar->SetForegroundColour(*wxWHITE);
wxString radioButtonsLabels[] = {_("Label 1"),_("Label 2")};
_itemRadioBox = new wxRadioBox( _toolbar, -1, _("RadioBox"), wxDefaultPosition, wxDefaultSize, 2, radioButtonsLabels, 1, wxRA_SPECIFY_COLS );
_itemRadioBox->SetSelection(0);
_itemRadioBox->SetBackgroundColour(*wxBLACK);
_itemRadioBox->SetForegroundColour(*wxWHITE);
_toolbar->AddControl(itemRadioBox );
And also the following code did not work:
Code: Select all
void SetWindowForegroundColour(wxWindow *wnd, const wxColour &col)
{
if(wnd)
{
wxButton *btn = wxDynamicCast(wnd, wxButton);
if(!btn)
wnd->SetForegroundColour(col);
// get every window, and make the foreground equal to the given one
wxWindowListNode *node = wnd->GetChildren().GetFirst();
while (node)
{
SetWindowForegroundColour(node->GetData(), col);
node = node->GetNext();
}
}
}
_toolbar->SetBackgroundColour(*wxBLACK);
_toolbar->SetForegroundColour(*wxWHITE);
wxString radioButtonsLabels[] = {_("Label 1"),_("Label 2")};
_itemRadioBox = new wxRadioBox( _toolbar, -1, _("RadioBox"), wxDefaultPosition, wxDefaultSize, 2, radioButtonsLabels, 1, wxRA_SPECIFY_COLS );
_itemRadioBox->SetSelection(0);
_itemRadioBox->SetBackgroundColour(*wxBLACK);
_itemRadioBox->SetForegroundColour(*wxWHITE);
SetWindowForegroundColour(_itemRadioBox,*wxWHITE);
_toolbar->AddControl(itemRadioBox );
SetWindowForegroundColour(_toolbar,*wxWHITE);