多个对话框应用 [英] Multiple dialog Application

查看:72
本文介绍了多个对话框应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个多对话应用程序,我可以在不同的对话之间前进和后退,就像我们在一些设置文件中一样按下按钮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 variable m_step. At first you set m_step=0 and you call a StateUpdatedHandler. This method looks at m_step value and calls the proper DoModal method (on m_step==0 it calls the first dialog's one). Once DoModal returns the m_step is updated (according to its result) and another dialog's DoModal 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆