Quantcast

wxMSW: How to align wxRadioBox with wxButton

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wxMSW: How to align wxRadioBox with wxButton

Andreas Falkenhahn
Please take a look at the attached screenshot. I want to align a wxRadioBox
with a wxButton but it doesn't work. It looks like wxRadioBox uses about 5
pixels of padding on its top border which makes it appear a little below
its neighbouring button.

Is there any way to remove this padding space and have wxRadioBox align
nicely with wxButton?

The code I'm using is this:

    wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
    wxArrayString strings;

    strings.Add(wxT("First item"));
    strings.Add(wxT("Second item"));
       
    wxButton *b = new wxButton(panel, -1, wxT("Test button"));
    wxRadioBox *rb = new wxRadioBox(panel, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, strings, 0, wxRA_SPECIFY_ROWS);

    hbox->Add(b, 1, 0);
    hbox->Add(rb, 0, 0);

Full demo source and screenshot attached.

--
Best regards,
 Andreas Falkenhahn                          mailto:[hidden email]

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users

test.cpp (1K) Download Attachment
screenshot.png (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxMSW: How to align wxRadioBox with wxButton

Vadim Zeitlin-4
On Sun, 26 Mar 2017 16:33:20 +0200 Andreas Falkenhahn wrote:

AF> Please take a look at the attached screenshot. I want to align a wxRadioBox
AF> with a wxButton but it doesn't work. It looks like wxRadioBox uses about 5
AF> pixels of padding on its top border which makes it appear a little below
AF> its neighbouring button.
AF>
AF> Is there any way to remove this padding space and have wxRadioBox align
AF> nicely with wxButton?

 The best you can do is to try to use wxStaticBox::GetBordersForSizer() and
use the top border value to offset your button too. But I'm not really sure
this is going to work that well.

 Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/

attachment0 (203 bytes) Download Attachment
Loading...