Fix initial numeric input char for Windows

This commit is contained in:
Charles J. Cliffe 2016-02-09 00:46:39 -05:00
parent f377d46467
commit 33c27c5684
2 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,7 @@
wxBEGIN_EVENT_TABLE(FrequencyDialog, wxDialog)
EVT_CHAR_HOOK(FrequencyDialog::OnChar)
EVT_SHOW(FrequencyDialog::OnShow)
wxEND_EVENT_TABLE()
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstance *demod, const wxPoint & position,
@ -14,6 +15,7 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
wxString freqStr;
activeDemod = demod;
this->targetMode = targetMode;
this->initialString = initString;
if (targetMode == FDIALOG_TARGET_DEFAULT) {
if (activeDemod) {
@ -54,7 +56,7 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
if (initString != "" && initString.length() == 1) {
dialogText->SetValue(initString);
dialogText->SetSelection(initString.length(), initString.length());
dialogText->SetSelection(2, 2);
dialogText->SetFocus();
} else {
if (initString != "") {
@ -183,3 +185,10 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
event.Skip();
}
}
void FrequencyDialog::OnShow(wxShowEvent &event) {
if (initialString.length() == 1) {
dialogText->SetSelection(2, 2);
dialogText->SetFocus();
}
}

View File

@ -34,6 +34,8 @@ private:
DemodulatorInstance *activeDemod;
void OnEnter ( wxCommandEvent &event );
void OnChar ( wxKeyEvent &event );
void OnShow(wxShowEvent &event);
FrequencyDialogTarget targetMode;
std::string initialString;
DECLARE_EVENT_TABLE()
};