TAILIEUCHUNG - Teach Yourself Visual C++ 6 in 21 Days phần 9

Thêm một mục trình đơn và hộp thoại cho phép người dùng chỉ ra con số kỷ lục để di chuyển, và sau đó chuyển hồ sơ đó. 1. Tạo một hộp thoại mới, thiết kế bố trí thoại như trong hình . Cấu hình các điều khiển như trong Bảng . Hình . Di chuyển bố trí hộp thoại. | Answers 621 I Exercise Add a menu entry and dialog to let the user indicate the record number to move to and then move to that record. 1. Create a new dialog designing the dialog layout as in Figure . Configure the controls as in Table . Figure . The Move To dialog layout. B Table . Dialog property settings. Object Property Setting Static Text ID IDC_STATIC Caption Move to record Edit Box ID IDC_ERECNBR 2. Open the Class Wizard. Create a new class for the new dialog. Give the new class the name CMoveToDlg. After you create the new class add a variable to the Edit Box control. Specify the variable type as long and the name as m_lRowNbr. 3. Add another menu entry to the main application menu. Specify the menu properties as in Table . I 622 Appendix B Table . Menu property settings. Object Property Setting Menu Entry ID IDM_RECORD_MOVE Caption Move To. Prompt Move to a specific record nMove To 4. Open the Class Wizard and add an event-handler function for the COMMAND message for this new menu to the view class. Edit this function adding the code in Listing . Listing . The CDbOdbcView OnRecordMove function. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 void CTestdb5View OnRecordMove TODO Add your command handler code here Create an instance of the Move To dialog CMoveToDlg dlgMoveTo Get the row number to move to if IDOK Get a pointer to the record set CRecordset pSet OnGetRecordset Make sure that there are no outstanding changes to be saved if pSet- CanUpdate pSet- IsDeleted pSet- Edit if UpdateData return pSet- Update Set the new position pSet- SetAbsolutePosition Update the form UpdateData FALSE 5. Include the header file for the new dialog in the view class source code as in line 10 of Listing . Answers 623 I Listing . The CDbOdbcView INCLUDES. 1 2 3 4 5 6 7 8 9 10 implementation of the CDbOdbcView class include include include include include include .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.