Dialog Applications Jim Fawcett Su 99 CSE 791
- Slides: 11
Dialog Applications Jim Fawcett Su ‘ 99 CSE 791 - Advanced Windows Programming Page 1
An Example Dialog Application CSE 791 - Advanced Windows Programming Page 2
Construction Steps · Run App Wizard – select Dialog Based – deselect Active. X Controls – pick names for classes · Edit dialog resource – add two edit boxes with static labels – add listbox – use layout to set tab order and align controls · Compile to see running application – application quits after an entry in either edit control CSE 791 - Advanced Windows Programming Page 3
Setting Tab Order CSE 791 - Advanced Windows Programming Page 4
Alignment Controls CSE 791 - Advanced Windows Programming Page 5
Construction Steps · Use class wizard from view menu – Using Member Variable tab • select IDC_EDIT 1 and add variable m_Edit 1 with category value • select IDC_EDIT 2 and add variable m_Edit 2 with category value • select IDC_LIST 1 and add variable m_List. Box with category control – Using Message Maps tab select IDOK and BN_CLICKED • • add function On. OK edit function to remove CDialog: : On. OK( ) add what ever processing you need to handle the entry will now respond to either the OK button or a carriage return in edit control • won’t close application CSE 791 - Advanced Windows Programming Page 6
Adding Member Variables CSE 791 - Advanced Windows Programming Page 7
Adding Message Handlers CSE 791 - Advanced Windows Programming Page 8
Construction Steps · Using Class Wizard – Using Message Maps tab select IDC_LIST 1 and LBN_SELCHANGE • add function On. Selchange. List 1 • edit code to add whatever functionality is needed with the list box – Using Message Maps tab select CDemo. Dlg and WN_LBUTTONDOWN • add function On. LButton. Down • edit code to add whatever functionality is needed with the dialog frame CSE 791 - Advanced Windows Programming Page 9
Resulting Dialog Structure CSE 791 - Advanced Windows Programming Page 10
Exploring Application Structure CSE 791 - Advanced Windows Programming Page 11