亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch22.htm

?? Learning language of Visual C++6
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
	to the menu, as shown in Figure 22.24.
	<P>
	<DT></DT>
	<DD><B>4. </B>Select the blank button again and draw a red minus sign, giving the
	button the <B>ID_RECORD_DELETE</B> ID, as you can see in Figure 22.25. Drag and drop
	the Add and Delete buttons to the left of the Help (question mark) button.
	<P>
</DL>

<P>Now that you have added the menu items and the toolbar buttons, you need to arrange
for code to catch the command message sent when the user clicks the button or chooses
the menu item. Background information on this process is in Chapter 3, &quot;Messages
and Commands,&quot; and in Chapter 8 and Chapter 9. Because it is the view that is
connected to the database, the view will catch these messages. Follow these steps:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Open ClassWizard and select the Message Maps tab.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc24.gif')"><B>FIG. 22.24</B></A><B> </B><I>Add
a button and connect it to the menu item.</I></P>
<P>

<DL>
	<DT><I></I></DT>
</DL>

<P><A HREF="javascript:popUp('22uvc25.gif')"><B>FIG. 22.25</B></A><B> </B><I>The
minus-sign button will control the Delete() function.</I></P>
<P>

<DL>
	<DD><B>2. </B>Set the Class Name box to CEmployeeView, click the ID_RECORD_ADD ID
	in the Object IDs box, and then double-click COMMAND in the Messages box. The Add
	Member Function dialog box appears, as shown in Figure 22.26.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc26.gif')"><B>FIG. 22.26</B></A><B> </B><I>Add
a function to catch the message.</I></P>
<P>

<DL>
	<DT><I></I></DT>
	<DD><B>3. </B>Click the OK button to accept the default name for the new function.
	The function appears in the Member Functions box at the bottom of the ClassWizard
	dialog box.
	<P>
	<DT></DT>
	<DD><B>4. </B>Add a member function for the ID_RECORD_DELETE command in the same
	way. The list of functions should resemble Figure 22.27. Click OK to close ClassWizard.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc27.gif')"><B>FIG. 22.27</B></A><B> </B><I>The
new functions appear in the Member Functions box.</I></P>
<P>

<DL>
	<DT><I></I></DT>
	<DD><B>5. </B>Open the EmployeeView.h file by double-clicking CEmployeeView in the
	ClassView pane. In the Attributes section of the class's declaration, add the following
	lines:
	<P>
</DL>



<BLOCKQUOTE>
	<PRE>protected:
 BOOL m_bAdding;</PRE>

</BLOCKQUOTE>

<PRE></PRE>

<DL>
	<DD><B>6. </B>Double-click the CEmployeeView constructor in ClassView to edit it,
	and add this line at the bottom of the function:
	<P>
</DL>



<BLOCKQUOTE>
	<PRE> m_bAdding = FALSE;</PRE>

</BLOCKQUOTE>

<PRE></PRE>

<DL>
	<DT></DT>
	<DD><B>7. </B>Double-click the OnRecordAdd() function and edit it so that it looks
	like Listing 22.1. This code is explained in the next section.
	<P>
</DL>

<H4>Listing 22.1&#160;&#160;CEmployeeView::OnRecordAdd()</H4>
<PRE>void CEmployeeView::OnRecordAdd()
{
    m_pSet-&gt;AddNew();
    m_bAdding = TRUE;
    CEdit* pCtrl = (CEdit*)GetDlgItem(IDC_EMPLOYEE_ID);
    int result = pCtrl-&gt;SetReadOnly(FALSE);
    UpdateData(FALSE);
</PRE>
<PRE>}
</PRE>

<DL>
	<DT></DT>
	<DD><B>8. </B>Right-click CEmployeeView in ClassView and choose Add Virtual Function.
	Select OnMove from the list on the left, as shown in Figure 22.28, and then click
	the Add and Edit button to add the function and to edit the skeleton code immediately.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc28.gif')"><B>FIG. 22.28</B></A><B> </B><I>Override
the OnMove() function.</I></P>
<P>

<DL>
	<DD><B>9. </B>Edit the OnMove() function so that it has the code in Listing 22.2.
	This code is explained in the next section.
	<P>
</DL>

<H4>Listing 22.2&#160;&#160;CEmployeeView::OnMove()</H4>
<PRE>BOOL CEmployeeView::OnMove(UINT nIDMoveCommand)
{
     if (m_bAdding)
     {
         m_bAdding = FALSE;
         UpdateData(TRUE);
         if (m_pSet-&gt;CanUpdate())
             m_pSet-&gt;Update();
         m_pSet-&gt;Requery();
         UpdateData(FALSE);
         CEdit* pCtrl = (CEdit*)GetDlgItem(IDC_EMPLOYEE_ID);
         pCtrl-&gt;SetReadOnly(TRUE);
         return TRUE;
     }
     else
         return CRecordView::OnMove(nIDMoveCommand);
</PRE>
<PRE>}
</PRE>

<DL>
	<DT></DT>
	<DD><B>10. </B>Double-click the OnRecordDelete() function and edit it so that it
	looks like Listing 22.3. This code is explained in the next section.
	<P>
</DL>

<H4>Listing 22.3&#160;&#160;CEmployeeView::OnRecordDelete()</H4>
<PRE>void CEmployeeView::OnRecordDelete()
{
        m_pSet-&gt;Delete();
        m_pSet-&gt;MoveNext();
        if (m_pSet-&gt;IsEOF())
              m_pSet-&gt;MoveLast();
        if (m_pSet-&gt;IsBOF())
              m_pSet-&gt;SetFieldNull(NULL);
        UpdateData(FALSE);
</PRE>
<PRE>}
</PRE>
<P>You've now modified the Employee application so that it can add and delete, as
well as update, records. After compiling the application, run it by selecting the
Build, Execute command from Developer Studio's menu bar or by pressing Ctrl+F5. When
you do, you see the Employee application's main window, which doesn't look any different
than it did in the preceding section. Now, however, you can add new records by clicking
the Add button on the toolbar (or by selecting the Record, Add Record command on
the menu bar) and delete records by clicking the Delete button (or by clicking the
Record, Delete Record command).</P>
<P>When you click the Add button, the application displays a blank record. Fill in
the fields for the record; then when you move to another record, the application
automatically updates the database with the new record. To delete a record, just
click the Delete button. The current record (the one on the screen) vanishes and
is replaced by the next record in the database.</P>
<P>
<H3><A NAME="Heading11"></A>Examining the OnRecordAdd() Function</H3>
<P>You might be wondering how the C++ code you added to the application works. OnRecordAdd()
starts with a call to the AddNew() member function of CEmployeeSet, the class derived
from CRecordSet. This sets up a blank record for the user to fill in, but the new
blank record doesn't appear on the screen until the view window's UpdateData() function
is called. Before that happens, you have a few other things to tackle.</P>
<P>After the user has created a new record, the database will need to be updated.
By setting a flag in this routine, the move routine will be able to determine whether
the user is moving away from an ordinary database record or a newly added one. That's
why m_bAdding is set to TRUE here.</P>
<P>Now, because the user is entering a new record, it should be possible to change
the contents of the Employee ID field, which is currently set to read-only. To change
the read-only status of the control, the program first obtains a pointer to the control
with GetDlgItem() and then calls the control's SetReadOnly() member function to set
the read-only attribute to FALSE.</P>
<P>Finally, the call to UpdateData() will display the new blank record.</P>
<P>
<H3><A NAME="Heading12"></A>Examining the OnMove() Function</H3>
<P>Now that the user has a blank record on the screen, it's a simple matter to fill
in the edit controls with the necessary data. To add the new record to the database,
the user must move to a new record, an action that forces a call to the view window's
OnMove() member function. Normally, OnMove() does nothing more than display the next
record. Your override will save new records as well.</P>
<P>When OnMove() is called, the first thing the program does is check the Boolean
variable m_bAdding to see whether the user is in the process of adding a new record.
If m_bAdding is FALSE, the body of the if statement is skipped and the else clause
is executed. In the else clause, the program calls the base class (CRecordView) version
of OnMove(), which simply moves to the next record.</P>
<P>If m_bAdding is TRUE, the body of the if statement is executed. There, the program
first resets the m_bAdding flag and then calls UpdateData() to transfer data out
of the view window's controls and into the recordset class. A call to the recordset's
CanUpdate() method determines whether it's okay to update the data source, after
which a call to the recordset's Update() member function adds the new record to the
data source.</P>
<P>To rebuild the recordset, the program must call the recordset's Requery() member
function, and then a call to the view window's UpdateData() member function transfers
new data to the window's controls. Finally, the program sets the Employee ID field
back to read-only, with another call to GetDlgItem() and SetReadOnly().</P>
<P>
<H3><A NAME="Heading13"></A>Examining the OnRecordDelete() Function</H3>
<P>Deleting a record is simple. OnRecordDelete() just calls the recordset's Delete()
function. When the record is deleted, a call to the recordset's MoveNext() arranges
for the record that follows to be displayed.</P>
<P>A problem might arise, though, when the deleted record was in the last position
or when the deleted record was the only record in the recordset. A call to the recordset's
IsEOF() function will determine whether the recordset was at the end. If the call
to IsEOF() returns TRUE, the recordset needs to be repositioned on the last record.
The recordset's MoveLast() function takes care of this task.</P>
<P>When all records have been deleted from the recordset, the record pointer will
be at the beginning of the set. The program can test for this situation by calling
the recordset's IsBOF() function. If this function returns TRUE, the program sets
the current record's fields to NULL.</P>
<P>Finally, the last task is to update the view window's display with another call
to UpdateData().</P>
<P>
<H3><A NAME="Heading14"></A>Sorting and Filtering</H3>
<P>In many cases when you're accessing a database, you want to change the order in
which the records are presented, or you may even want to search for records that
fit certain criteria. MFC's ODBC database classes feature member functions that enable
you to sort a set of records on any field. You can also call member functions to
limit the records displayed to those whose fields contain given information, such
as a specific name or ID. This latter operation is called <I>filtering</I>. In this
section, you will add sorting and filtering to the Employee application. Just follow
these steps:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Add a Sort menu to the application's menu bar, as shown in Figure 22.29.
	Let Developer Studio set the command IDs.
	<P>
	<DT></DT>
	<DD><B>2. </B>Use ClassWizard to arrange for CEmployeeView to catch the four new
	sorting commands, using the function names suggested by ClassWizard. Figure 22.30
	shows the resultant ClassWizard property sheet.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc29.gif')"><B>FIG. 22.29</B></A><B> </B><I>The
Sort menu has four commands for sorting the database.</I></P>
<P><A HREF="javascript:popUp('22uvc30.gif')"><B>FIG. 22.30</B></A><B> </B><I>After
you add the four new functions, ClassWizard looks like this.</I></P>
<P>

<DL>
	<DD><B>3. </B>Add a Filter menu to the application's menu bar, as shown in Figure
	22.31. Let Developer Studio set the command IDs.
	<P>
	<DT></DT>
	<DD><B>4. </B>Use ClassWizard to arrange for CEmployeeView to catch the four new
	filtering commands, using the function names suggested by ClassWizard.
	<P>
	<DT></DT>
	<DD><B>5. </B>Create a new dialog box by choosing Insert, Resource and double-clicking
	Dialog; then edit the dialog so that it resembles the dialog box shown in Figure
	22.32. Give the edit control the ID <B>IDC_FILTERVALUE</B>. Give the entire dialog
	the ID <B>IDD_FILTER</B>.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc31.gif')"><B>FIG. 22.31</B></A><B> </B><I>The
Filter menu has four commands.</I></P>
<P><A HREF="javascript:popUp('22uvc32.gif')"><B>FIG. 22.32</B></A><B> </B><I>Create
a filter dialog box.</I></P>
<P>

<DL>
	<DD><B>6. </B>Start ClassWizard while the new dialog box is on the screen. The Adding
	a Class dialog box appears. Select the Create a New Class option and click OK.
	<P>
	<DT></DT>
	<DD><B>7. </B>The New Class dialog box appears. In the Name box, type <B>CFilterDlg</B>,
	as shown in Figure 22.33. Click OK to add the class.
	<P>
</DL>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人综合日日夜夜| 国产色产综合产在线视频| 6080yy午夜一二三区久久| 欧美精品三级在线观看| 日韩欧美高清在线| 欧美激情一区二区| 一区在线中文字幕| 午夜精品视频在线观看| 国产一区二区在线电影| av电影在线观看一区| 色噜噜狠狠成人中文综合| 91精品国产福利在线观看| 久久久精品黄色| 亚洲精品福利视频网站| 麻豆一区二区三区| 色天天综合色天天久久| 精品91自产拍在线观看一区| 中文字幕在线观看一区| 日欧美一区二区| 91丨porny丨中文| 久久久久久一级片| 午夜精品久久久久影视| 韩国成人福利片在线播放| 色综合久久久久| 亚洲精品一线二线三线无人区| 亚洲色图视频网站| 久久成人免费电影| 欧美日韩你懂的| 亚洲欧美日韩中文字幕一区二区三区 | 亚洲第一狼人社区| av一区二区三区在线| 久久久久久久综合日本| 全国精品久久少妇| 欧美性受xxxx黑人xyx性爽| 国产精品久久久久一区二区三区 | 粉嫩欧美一区二区三区高清影视| 欧美绝品在线观看成人午夜影视| 最新成人av在线| 成人av在线资源网| 国产亚洲人成网站| 国产盗摄视频一区二区三区| 精品免费国产一区二区三区四区| 日本网站在线观看一区二区三区 | 久草热8精品视频在线观看| 欧美高清视频一二三区| 一区二区三区四区蜜桃| 91九色02白丝porn| 一区二区国产视频| 欧洲一区二区av| 日韩高清欧美激情| 日韩精品专区在线影院重磅| 韩国精品久久久| 中文在线资源观看网站视频免费不卡| 国产盗摄视频一区二区三区| 国产清纯白嫩初高生在线观看91 | 亚洲综合清纯丝袜自拍| 欧美精品高清视频| 日本va欧美va精品发布| 久久先锋影音av| 99re热这里只有精品视频| 亚洲一卡二卡三卡四卡五卡| 91麻豆精品国产91| 黄色资源网久久资源365| 中文字幕一区视频| 欧美精品久久天天躁| 国产麻豆精品一区二区| 一区二区三区国产精华| 欧美一区二区三区精品| 成人精品免费视频| 轻轻草成人在线| 国产精品久久久久影院亚瑟| 777奇米成人网| 菠萝蜜视频在线观看一区| 视频一区在线播放| 国产精品久久午夜夜伦鲁鲁| 欧美精品色一区二区三区| 粉嫩高潮美女一区二区三区| 午夜视频一区在线观看| 国产精品九色蝌蚪自拍| 久久夜色精品国产噜噜av| 在线观看免费视频综合| 成人美女视频在线看| 青草av.久久免费一区| 一区二区三区免费看视频| 久久天堂av综合合色蜜桃网| 91精品国产丝袜白色高跟鞋| 91亚洲精品乱码久久久久久蜜桃 | 色婷婷亚洲精品| 国产成人av电影| 久久97超碰国产精品超碰| 亚洲一区二区三区四区五区黄 | 国内精品久久久久影院色| 亚洲成av人片| 亚洲二区在线观看| 亚洲黄色小视频| 一区二区三区视频在线看| 国产精品传媒入口麻豆| 国产精品乱人伦中文| 国产日韩精品一区二区浪潮av| 欧美va天堂va视频va在线| 51午夜精品国产| 91精品国产综合久久精品 | 韩国一区二区视频| 国产精品一区免费视频| 国产在线视视频有精品| 久久精品免费观看| 成人综合在线观看| 97久久超碰国产精品电影| 91一区一区三区| 欧美在线短视频| 欧美一二三区精品| 欧美精品一区二区三区四区| 国产拍欧美日韩视频二区| 国产精品妹子av| 午夜久久久久久电影| 美国毛片一区二区| 成人免费看片app下载| 欧美日韩夫妻久久| 欧美videofree性高清杂交| 亚洲国产精品精华液2区45| 欧美激情一区在线观看| 亚洲伊人色欲综合网| 日韩av一级电影| 成人av电影在线播放| 精品视频在线免费| 久久久久亚洲综合| 亚洲国产综合人成综合网站| 久久精品国产99国产| 成人高清免费观看| 欧美日本在线看| 国产精品久久午夜夜伦鲁鲁| 日韩电影在线免费观看| jiyouzz国产精品久久| 日韩一区二区免费在线观看| 中文字幕中文在线不卡住| 日韩在线a电影| 欧美中文字幕不卡| 国产精品乱码一区二区三区软件| 香蕉av福利精品导航| 国产91在线观看| 精品国产一区二区亚洲人成毛片| 亚洲精品成人悠悠色影视| 国产精品影视网| 日韩精品专区在线影院重磅| 亚洲国产aⅴ天堂久久| 不卡的看片网站| 欧美国产日韩在线观看| 极品美女销魂一区二区三区免费| 欧美精品久久一区| 亚洲成人免费电影| 欧美日韩一区二区在线观看视频| 亚洲免费av在线| 91美女精品福利| 日本一二三不卡| 成人免费毛片a| 国产精品夫妻自拍| 99久久精品99国产精品| 国产精品久久久久久久久动漫| 国产精品99久久久久久似苏梦涵 | 欧美美女直播网站| 亚洲一区视频在线| 欧美另类高清zo欧美| 日韩精品久久久久久| 精品免费国产一区二区三区四区| 蜜桃av一区二区三区| 国产女同互慰高潮91漫画| 国产91清纯白嫩初高中在线观看| 亚洲色图欧洲色图婷婷| 欧美色综合网站| 国内精品免费**视频| 国产精品久久久久久久久久久免费看 | 国产精品久久久久久久久快鸭| 91视频www| 蜜臀va亚洲va欧美va天堂| 国产午夜亚洲精品不卡| 91丨九色丨蝌蚪富婆spa| 午夜精品久久久久久久99樱桃| 26uuu久久天堂性欧美| av爱爱亚洲一区| 免费看欧美美女黄的网站| 国产精品污污网站在线观看| 欧美日韩五月天| 国产精品一二三四五| 亚洲国产婷婷综合在线精品| 88在线观看91蜜桃国自产| 久久久久一区二区三区四区| 成人污污视频在线观看| 亚洲国产婷婷综合在线精品| 日本一区二区成人| 欧美丰满少妇xxxbbb| 99精品国产热久久91蜜凸| 久久国产精品露脸对白| 中文字幕综合网| 久久精品一区八戒影视| 欧美一区二区三区免费大片| 在线观看中文字幕不卡| 成人夜色视频网站在线观看| 久久99国内精品| 日韩电影在线一区二区| 亚洲成av人片在www色猫咪|