對話框之一

During the life cycle of a dialog box, the user invokes the dialog box, typically inside a command handler that creates and initializes the dialog object, the user interacts with the dialog box, and the dialog box closes.

For modal dialog boxes, your handler gathers any data the user entered once the dialog box closes. Since the dialog object exists after its dialog window has closed, you can simply use the member variables of your dialog class to extract the data.

For modeless dialog boxes, you may often extract data from the dialog object while the dialog box is still visible. At some point, the dialog object is destroyed; when this happens depends on your code.

 

一般地,對話框是在響應一個命令消息的時候被創建的,也就是在一個command handller裏創建一個對話框,用戶和該對話框進行交互然後關閉該對話框。 對於模態對話框,你寫的command handller一般在對話框被關閉後來獲取用戶在對話框裏輸入的數據,對話框窗口被關閉後對話框對象依然是存在的,你依然可以調用對話框的成員來獲取用戶已輸入的信息。對於非模態對話框,你可以在對話框不關閉的時候就隨時獲取對話框對象裏的數據。對話框對象何時被銷燬完全取決於你的代碼。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章