1
0
Fork 0

In Properties dialog, create the button first

So the foucus goes to the OK button on init. This will let wxWidgets correctly handle the initial position of text in wxTextCtrl

Fix wangqr/Aegisub#6
This commit is contained in:
wangqr 2019-09-15 19:32:49 -04:00
parent f1ef3d2d2c
commit e51b93683d
1 changed files with 8 additions and 5 deletions

View File

@ -91,6 +91,14 @@ DialogProperties::DialogProperties(agi::Context *c)
{
d.SetIcon(GETICON(properties_toolbutton_16));
// Button sizer
// Create buttons first. See:
// https://github.com/wangqr/Aegisub/issues/6
// https://trac.wxwidgets.org/ticket/18472#comment:9
auto ButtonSizer = d.CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxHELP);
d.Bind(wxEVT_BUTTON, &DialogProperties::OnOK, this, wxID_OK);
d.Bind(wxEVT_BUTTON, std::bind(&HelpButton::OpenPage, "Properties"), wxID_HELP);
// Script details crap
wxSizer *TopSizer = new wxStaticBoxSizer(wxHORIZONTAL,&d,_("Script"));
auto TopSizerGrid = new wxFlexGridSizer(0,2,5,5);
@ -156,11 +164,6 @@ DialogProperties::DialogProperties(agi::Context *c)
optionsGrid->AddGrowableCol(1,1);
optionsBox->Add(optionsGrid,1,wxEXPAND,0);
// Button sizer
auto ButtonSizer = d.CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxHELP);
d.Bind(wxEVT_BUTTON, &DialogProperties::OnOK, this, wxID_OK);
d.Bind(wxEVT_BUTTON, std::bind(&HelpButton::OpenPage, "Properties"), wxID_HELP);
// MainSizer
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
MainSizer->Add(TopSizer,0,wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND,5);