多个对话框应用 [英] Multiple dialog Application
问题描述
我想制作一个多对话应用程序,我可以在不同的对话之间前进和后退,就像我们在一些设置文件中一样按下按钮Next和back,到目前为止我使用的是doModal函数,我可以向一个方向移动即前进但当我回来时对话失去了它的功能,即它不会向前移动。
这是第一个对话按钮的代码片段:
OnOK();
新a; //第二个对话对象
a.DoModal(); //
第二个:
CDialog d(IDD_DIALOGCREATION_DIALOG); //第一个对话对象
d.DoModal();
I want to make a multiple dialogue application in which I can move forward and backward between different dialogues like we do in some setup files by pressing button Next and back , So far i am using doModal function , I can move in one direction i.e. forward but when I come back dialogue lost its functionality i.e. it doesn't move forward.
Here is the piece of code for first dialogue button:
OnOK();
New a; //second dialogue object
a.DoModal(); //
For Second one :
CDialog d (IDD_DIALOGCREATION_DIALOG);// first dialogue object
d.DoModal();
推荐答案
状态机可以解决您的问题:假设您将状态保存在变量<$ c $中C> m_step 。首先设置m_step = 0
,然后调用StateUpdatedHandler
。此方法查看m_step
值并调用正确的DoModal
方法(在m_step == 0上)
它调用第一个对话框的一个)。一旦DoModal
返回m_step
更新(根据其结果)和另一个对话框的DoModal
被调用。这个循环继续,直到用户完成整个过程(或中止它)。
A state machine could solve your problem: suppose you keep the state in a variablem_step
. At first you setm_step=0
and you call aStateUpdatedHandler
. This method looks atm_step
value and calls the properDoModal
method (onm_step==0
it calls the first dialog's one). OnceDoModal
returns them_step
is updated (according to its result) and another dialog'sDoModal
is called. This loop goes on until the user completed the whole process (or aborts it).
我认为你的意思是如何创建向导 [ ^ ]。
I think you mean How to Create Wizards[^].
这篇关于多个对话框应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!