Page 1 of 1

wxRadioBox appearance on Mac is messed up

Posted: Wed Aug 21, 2019 7:06 pm
by deepti
Hi All,

The following Radio Box implementation looks fine on Windows. But on Mac, the buttons appear with lots of spaces before the first button and also in between two buttons!
How can i fix this? Please help.

Code: Select all

wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);

wxArrayString expireOptions = wxArrayString();
expireOptions.push_back(_("Never Expires"));
expireOptions.push_back(_("Expires"));
expiryRadioBox = new wxRadioBox(itemDialog1, RADIOBOX_DATE, "Expires (Optional)", wxDefaultPosition, shareOptionsSize, expireOptions, 0, wxNO_BORDER);
expiryRadioBox->SetSelection(0);

wxStaticBoxSizer *rBoxSizer = new wxStaticBoxSizer(wxHORIZONTAL, this,"");
rBoxSizer->Add(expiryRadioBox, 0, wxEXPAND);

itemBoxSizer7->Add(rBoxSizer, 0, wxALIGN_LEFT | wxALL, 5);

Re: wxRadioBox appearance on Mac is messed up

Posted: Thu Aug 22, 2019 6:05 am
by deepti
Can anyone help me on this please?

Re: wxRadioBox appearance on Mac is messed up

Posted: Thu Aug 22, 2019 6:26 am
by PB
I do not use OSX and it may not be the issue since you say it works on MSW but...

To me, the parents you create the controls with seem odd.

The expiryRadioBox (wxRadioBox) is created with itemDialog1 as the parent, whatever itemDialog1 is.
Then rBoxSizer (wxStaticBoxSizer) is created with this as the parent and then expiryRadioBox is added to it.
This does not look as the correct parent/child hierarchy to me.

I would create rBoxSizer first with a proper parent, i.e., the one above it in the dialog/frame hierarchy and then created expiryRadioBox with rBoxSizer->GetStaticBox() as the parent.

Re: wxRadioBox appearance on Mac is messed up

Posted: Fri Aug 23, 2019 11:50 am
by deepti
The issue is that for the size of the radiobox, if i use wxDefaultSize, then it looks ok. But if i use shareOptionsSize (which is wxSize(185,-1)) , then it appears messed up, only on Mac. But looks perfect on Windows
There are 4 radioboxes one below the other. So, for better appearance i want the size of all of them to be the same. Is there any way i can achieve this on Mac ?

Re: wxRadioBox appearance on Mac is messed up

Posted: Fri Aug 23, 2019 2:43 pm
by ONEEYEMAN
Hi,
Why?
Keep in mind that different OSes uses different sizing, different fonts, different UI guidelines, etc.
That's exactly why you should use sizers and not absolute positioning.

You can probably try to do conditional compilation here, but there is no need - just use sizers.

Thank you.