MGR: Work around apparent wxCocoa 3.0 bugs in Select Computer dialog on Mac

This commit is contained in:
Charlie Fenton 2014-01-30 05:08:29 -08:00
parent 261dcb1be2
commit ce346b5133
2 changed files with 23 additions and 2 deletions

View File

@ -52,6 +52,7 @@ BEGIN_EVENT_TABLE( CDlgSelectComputer, wxDialog )
////@begin CDlgSelectComputer event table entries
EVT_TEXT( ID_SELECTCOMPUTERNAME, CDlgSelectComputer::OnComputerNameUpdated )
EVT_COMBOBOX( ID_SELECTCOMPUTERNAME, CDlgSelectComputer::OnComputerNameUpdated )
////@end CDlgSelectComputer event table entries
@ -168,8 +169,22 @@ void CDlgSelectComputer::CreateControls(bool required)
itemBoxSizer10->Add(itemButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
// Set validators
m_ComputerNameCtrl->SetValidator( wxGenericValidator(& m_strComputerName) );
m_ComputerPasswordCtrl->SetValidator( wxGenericValidator(& m_strComputerPassword) );
// Under wxCocoa 3.0, wxGenericValidator doesn't work right here
m_ComputerNameCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, & m_strComputerName) );
m_ComputerPasswordCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, & m_strComputerPassword) );
#ifdef __WXMAC__
// Set keyboard shortcuts - why is this necessary?
m_Shortcuts[0].Set(wxACCEL_CTRL, 'x', wxID_CUT);
m_Shortcuts[1].Set(wxACCEL_CTRL, 'c', wxID_COPY);
m_Shortcuts[2].Set(wxACCEL_CTRL, 'v', wxID_PASTE);
m_pAccelTable = new wxAcceleratorTable(3, m_Shortcuts);
m_ComputerPasswordCtrl->SetAcceleratorTable(*m_pAccelTable);
// I don't know why this works for m_ComputerPasswordCtrl but not m_ComputerNameCtrl
m_ComputerNameCtrl->SetAcceleratorTable(*m_pAccelTable);
#endif
////@end CDlgSelectComputer content construction
}

View File

@ -114,6 +114,12 @@ public:
wxString m_strComputerName;
wxString m_strComputerPassword;
////@end CDlgSelectComputer member variables
#ifdef __WXMAC__
protected:
wxAcceleratorEntry m_Shortcuts[3]; // For Copy, Cut & Paste keyboard shortcuts
wxAcceleratorTable* m_pAccelTable;
#endif
};
#endif