wxRadioBox does not work right on higher resolution displays

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Victory
Earned some good credits
Earned some good credits
Posts: 115
Joined: Fri Mar 19, 2010 1:20 am

wxRadioBox does not work right on higher resolution displays

Post by Victory »

I am noticing that the labels of choices in wxRadioBox are getting truncated when the radio box is displayed on a higher resolution laptop. Seems like the size is not getting reported correctly there.

I am pasting below simple code that reproduces the issue. The two screenshots below show how the window looks when displayed on a lower resolution laptop vs higher resolution laptop.

Note that the ending letters "A"/"B" of "ChoiceA"/"ChoiceB" are getting cut off when displayed on higher resolution display.
Any idea about the cause of this?

I am trying this on Windows 10 with wxWidgets-3.0.3.
Lower res display: 1366x768
Higher res display: 3200x1800

Thanks.

Code: Select all

#include "wx/wx.h"

class MyApp : public wxApp
{
public:
    virtual bool OnInit();
};

class MyFrame : public wxFrame
{
public:
    MyFrame(const wxString& title);

    void OnQuit(wxCommandEvent& event);

private:
    DECLARE_EVENT_TABLE()
};

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    MyFrame* pFrame = new MyFrame(wxT("Radio Box incorrect size"));
    pFrame->Show(true);
    return true;
}

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(wxID_EXIT,  MyFrame::OnQuit)
END_EVENT_TABLE()

void MyFrame::OnQuit(wxCommandEvent& event)
{
    Close();
}

MyFrame::MyFrame(const wxString& title)
       : wxFrame(NULL, wxID_ANY, title)
{
   wxBoxSizer* pSizer = new wxBoxSizer(wxHORIZONTAL);

   wxPanel* pPanel = new wxPanel(this);
   wxSizer* pPanelSizer = new wxBoxSizer(wxHORIZONTAL);
   pPanel->SetSizer(pPanelSizer);
   const wxString choices[] = {wxString("ChoiceA"), wxString("ChoiceB")};
   wxRadioBox* pRadioBox = new wxRadioBox(pPanel, wxID_ANY, "Size Test", wxDefaultPosition, wxDefaultSize, 2, choices, 1, wxRA_SPECIFY_ROWS);
   pPanelSizer->Add(pRadioBox, 0);
   pSizer->Add(pPanel, 1, wxEXPAND);

   SetSizer(pSizer);
   Layout();
   pSizer->Fit(this); 
}
Attachments
RadioBox_LowResDisplay.PNG
RadioBox_LowResDisplay.PNG (4.77 KiB) Viewed 871 times
RadioBox_HighResDisplay.PNG
RadioBox_HighResDisplay.PNG (12.32 KiB) Viewed 871 times
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxRadioBox does not work right on higher resolution displays

Post by ONEEYEMAN »

Hi,
wxWidgets version?
OS/toolkit?

Thank you.
Victory
Earned some good credits
Earned some good credits
Posts: 115
Joined: Fri Mar 19, 2010 1:20 am

Re: wxRadioBox does not work right on higher resolution displays

Post by Victory »

Quoting from my post above:
I am trying this on Windows 10 with wxWidgets-3.0.3.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxRadioBox does not work right on higher resolution displays

Post by ONEEYEMAN »

Hi,
Can you try with wx 3.1 or even Git HEAD?
HiDPI is not really finalized API-wise and there are still some quirks about it.

Thank you.
Post Reply