Here is how my app looks like on low dpi :
Here is how my app looks like on high dpi :
As you can see the "Output Folder" is not aligned with the "Input File".
As well as the "Select / Unselect All" is also not aligned with the "Reports" static text
Here is my Application's wxDialog code :
Code: Select all
class myDialog : public wxDialog {
public:
myDialog(wxFrame* parent, wxWindowID id, const wxString& title) : wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE) {
wxBoxSizer* vertical_sizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* input_file_sizer = new wxBoxSizer(wxHORIZONTAL);
wxFont bigfont;
bigfont.SetPointSize(11);
wxFont smallfont;
smallfont.SetPointSize(10);
input_file = new wxStaticText(this,wxID_ANY,"Input File:",wxDefaultPosition, wxDefaultSize);
// input_file->SetMinSize(wxSize(120, 22));
input_file->SetFont(bigfont);
i_button = new wxTextCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize);
i_button->SetMinSize(FromDIP(wxSize(500, 22)));
i_showfile = new wxButton(this,wxID_ANY,"...");
i_showfile->SetMinSize(FromDIP(wxSize(30, 22)));
input_file_sizer->Add(input_file,0,wxLEFT,63);
input_file_sizer->AddSpacer(11);
input_file_sizer->Add(i_button);
input_file_sizer->AddSpacer(11);
input_file_sizer->Add(i_showfile,0,wxRIGHT,12);
// Second Sizer
wxBoxSizer* output_file_sizer = new wxBoxSizer(wxHORIZONTAL);
output_file = new wxStaticText(this, wxID_ANY, "Output Folder:", wxDefaultPosition, wxDefaultSize);
// input_file->SetMinSize(wxSize(120, 22));
output_file->SetFont(bigfont);
o_button = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
o_button->SetMinSize(FromDIP(wxSize(500, 22)));
o_showfile = new wxButton(this, wxID_ANY, "...");
o_showfile->SetMinSize(FromDIP(wxSize(30, 22)));
output_file_sizer->Add(output_file, 0, wxLEFT, 32);
output_file_sizer->AddSpacer(11);
output_file_sizer->Add(o_button);
output_file_sizer->AddSpacer(11);
output_file_sizer->Add(o_showfile, 0, wxRIGHT, 14);
// Third Sizer
wxBoxSizer* reports_select_sizer = new wxBoxSizer(wxHORIZONTAL);
reports = new wxStaticText(this, wxID_ANY, "Reports:", wxDefaultPosition, wxDefaultSize);
// input_file->SetMinSize(wxSize(120, 22));
reports->SetFont(bigfont);
select_all = new wxCheckBox(this, wxID_ANY,"Select / Unselect All", wxDefaultPosition, wxDefaultSize, wxCHK_3STATE);
select_all->SetFont(smallfont);
reports_select_sizer->Add(reports, 0, wxLEFT, 70);
reports_select_sizer->AddSpacer(11);
reports_select_sizer->Add(select_all,0,wxLEFT,4);
// Fourth Sizer
wxBoxSizer* reports_list_sizer = new wxBoxSizer(wxHORIZONTAL);
wxArrayString sctr;
sctr.Add("test 1");
sctr.Add("test 2");
sctr.Add("test 3");
sctr.Add("test 4");
sctr.Add("test 5");
sctr.Add("test 6");
reports_list = new wxCheckListBox(this,wxID_ANY,wxDefaultPosition, wxDefaultSize,sctr, wxLB_ALWAYS_SB);
reports_list->SetMinSize(FromDIP(wxSize(500,120)));
reports_list->SetFont(smallfont);
reports_list_sizer->Add(reports_list,0,wxLEFT,137);
// Fifth Sizer
wxBoxSizer* generate_sizer = new wxBoxSizer(wxHORIZONTAL);
generate_reports = new wxButton(this, wxID_ANY, "testing.........", wxDefaultPosition, wxDefaultSize, wxLB_ALWAYS_SB);
generate_reports->SetMinSize(FromDIP(wxSize(120, 22)));
open_output_folder = new wxButton(this, wxID_ANY, "testing.........", wxDefaultPosition, wxDefaultSize, wxLB_ALWAYS_SB);
open_output_folder->SetMinSize(FromDIP(wxSize(120, 22)));
generate_sizer->Add(generate_reports, 0, wxLEFT, 137);
generate_sizer->AddSpacer(2);
generate_sizer->Add(open_output_folder);
vertical_sizer->Add(input_file_sizer, 0, wxTOP, 20);
vertical_sizer->Add(output_file_sizer, 0, wxTOP, 8);
vertical_sizer->Add(reports_select_sizer,0,wxTOP,8);
vertical_sizer->Add(reports_list_sizer,0,wxTOP,8);
vertical_sizer->Add(generate_sizer, 0, wxTOP, 8);
vertical_sizer->SetSizeHints(this);
SetSizer(vertical_sizer);
// to smaller size
Layout();
};
I'm also using FromDIP() so that the size can be converted to dpi.
/* More Questions on Sizers on Both Low Dpi and High Dpi */
I also wanted to ask about why the "Input File" static text and the the text box next to it, are not aligned. ( The Same applies for the "Output Folder" static text )
Also am I using sizers properly ?
Thank you