23 ON_BN_CLICKED( IDOK, OnBnClickedOk )
24 ON_EN_SETFOCUS( IDC_DRIVERS_EDIT_PASSWORD, OnEnSetfocusLoginEdit )
25 ON_EN_KILLFOCUS( IDC_DRIVERS_EDIT_PASSWORD, OnEnKillfocusLoginEdit )
26 ON_EN_SETFOCUS( IDC_DRIVERS_EDIT_ID, OnEnSetfocusLoginEdit )
27 ON_EN_KILLFOCUS( IDC_DRIVERS_EDIT_ID, OnEnKillfocusLoginEdit )
29 ON_LBN_SETFOCUS( IDC_DRIVERS_LST_DRIVERS, OnLbnSetfocusDriverList )
30 ON_LBN_KILLFOCUS( IDC_DRIVERS_LST_DRIVERS, OnLbnKillfocusDriverList )
38 CDriverLoginDlg::CDriverLoginDlg
45 , mSelectedIndex( -1 )
47 , mDriverPassword( _T("") )
64 CDataExchange * aDataExchange
67 CDialog::DoDataExchange( aDataExchange );
82 CDialog::OnInitDialog();
88 SetWindowPos( NULL, 700, 350, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
103 mSelectedIndex = mListBox.GetCurSel();
104 int topIndex = mListBox.GetTopIndex();
107 mListBox.ResetContent();
109 for( ; iter != mCom.mDriverLogins.
end(); iter++ )
111 if( iter->second.isValid() )
113 listItem.Format( _T(
"%s"), iter->second.getDriverId() );
114 mListBox.AddString( listItem );
122 mListBox.SetCurSel( mSelectedIndex );
123 mListBox.SetTopIndex( topIndex );
134 if( mSelectedIndex >= 0 )
136 mCom.mDriverLogins.remove( mCom.mDriverLogins.getKeyAt( mSelectedIndex ) );
140 if( mSelectedIndex < 0 )
155 char driverPassword[20];
157 WideCharToMultiByte( CP_UTF8, 0, mDriverId, -1, driverId,
sizeof( driverId ), NULL, NULL );
158 WideCharToMultiByte( CP_UTF8, 0, mDriverPassword, -1, driverPassword,
sizeof( driverPassword ), NULL, NULL );
163 mCom.mDriverLogins.put( login );
177 if( mDriverId !=
"" && mDriverPassword !=
"" )
197 mSelectedIndex = driverListBox->GetCurSel();
199 if( mSelectedIndex >= 0 && mSelectedIndex < driverListBox->GetCount() )
201 DriverLoginItem& item = mCom.mDriverLogins.get( mCom.mDriverLogins.getKeyAt( mSelectedIndex ) );
209 OnEnChangeEditBoxes();
216 driverListBox->SetCurSel( mSelectedIndex );
245 CDialog::PostNcDestroy();
267 SendMessage( DM_SETDEFID, IDOK );
287 SendMessage( DM_SETDEFID, IDOK );
afx_msg void OnLbnSelchangeDriverList()
Selection Changed handler for the Driver List box.
#define IDC_DRIVERS_EDIT_ID
#define IDC_DRIVERS_EDIT_PASSWORD
const_iterator begin()
Iterator positioned at the first element in the map.
BOOL OnInitDialog()
This function is called when the window is created.
afx_msg void OnBnClickedOk()
Button handler for the OK button.
CString getDriverId() const
Get the driver ID as a CString.
afx_msg void OnLbnKillfocusDriverList()
Handles the kill focus event for the driver list.
afx_msg void OnBnClickedDelete()
Button handler for the Delete button.
#define IDC_DRIVERS_BTN_DELETE
afx_msg void OnBnClickedSet()
Button handler for the Set button.
const_iterator end()
Iterator positioned after the last element in the map.
virtual ~CDriverLoginDlg()
Destructor.
afx_msg void OnEnKillfocusLoginEdit()
Handles the kill focus event for the driver ID and password edit boxes.
afx_msg void OnEnChangeEditBoxes()
Edit handler for the Driver ID and Driver Password boxes.
Serial communication controller for Garmin and FMI packets.
afx_msg void OnEnSetfocusLoginEdit()
Handles the set focus event for the driver ID and password edit boxes.
#define IDC_DRIVERS_BTN_SET
afx_msg void OnCancel()
Handler for the Cancel action.
void updateListBox()
Update the canned response list box from the canned response map owned by FmiApplicationLayer.
Map whose contents are also saved to a file.
afx_msg void OnLbnSetfocusDriverList()
Handles the set focus event for the driver list.
Dialog allowing the user to manage canned responses.
#define IDD_DRIVER_LOGINS
virtual void DoDataExchange(CDataExchange *aDataExchange)
Perform dialog data exchange and validation.
void PostNcDestroy()
Called by MFC after the window has been destroyed; performs final termination activities.
CString getPassword() const
Set the ID (key) of this item.
void setPassword(const std::string &aPassword)
Set the password of this driver.
#define IDC_DRIVERS_LST_DRIVERS
Data structure to holds an allowed driver login (ID and password). Used by the FmiApplicationLayer to...