wxRadioBox appearance on Mac is messed up

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

wxRadioBox appearance on Mac is messed up

Post 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);
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxRadioBox appearance on Mac is messed up

Post by deepti »

Can anyone help me on this please?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxRadioBox appearance on Mac is messed up

Post 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.
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxRadioBox appearance on Mac is messed up

Post 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 ?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxRadioBox appearance on Mac is messed up

Post 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.
Post Reply