Teach Yourself Visual C++ 6 in21 Days phần 9

bạn có thể vượt qua một tham số duy nhất để chức năng này. Tham số này là một con trỏ đến bất cứ thứ gì có chứa tất cả các thông tin chủ đề cần phải thực hiện nhiệm vụ của mình. Đối với các ứng dụng mà bạn đã được xây dựng trong chương này, các tham số có thể là một con trỏ đến các spinner đề sẽ hoạt động | 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 .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
99    427    2    22-05-2024
Đã 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.