如何在 borland c++ 中创建模态和无模态表单建设者
我有一项任务是增强用 Borland c++ 编写的现有工具,我是编程和 c++ 构建器的新手。任务是将弹出的消息框集成到主窗体本身中,我通过向项目添加新窗体并调用它来代替消息框,成功完成了这一任务。 我已将新表单设为模式,以便控制被阻止,直到用户选择一个选项。
现在,我在项目中添加了另一个名为 graph 的表单来显示图表,并且我希望当用户单击新表单中的按钮时控件转到该图表。
有没有办法使两个子窗体成为无模式并仅阻止父窗体(模态)。简而言之,我想访问我添加到项目中的两个新窗体,并且我不想访问我的主窗体,直到我做出这两种形式的所有选择。请帮忙!
I have an assignment to enhance an already existing tool written in Borland c++, I am new to programming and c++ builder. The task is to integrate message box which pops up, in to the main form itself,which I have successfully done by adding a new form to the project and calling it in place of message box.
I have made my new form modal so that control is blocked,till user selects an option.
Now I have added another form named graph to the project to show a graph and I want the control to go to the graph when user clicks a button in the new form.
Is there a way to make two children modeless and block only the parent form(modal).In short I want to access both the new forms I have added to my project and I don't want to access my main form,till I make all selections in these two forms.Kindly help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将父窗体的
Enabled
属性设置为 false,使用Show()
显示两个窗体,而不是使用ShowModal()
,然后当两个窗体都关闭时,将父窗体的Enabled
属性设置回 true。Rather than using
ShowModal()
, you could set the parent Form'sEnabled
property to false, useShow()
to show both forms, and then set the parent Form'sEnabled
property back to true when both forms have been closed.您可以从
OnCreate()
方法中移动您不想在create
期间自动运行的函数。您可以将它们移动到例如OnClick()
。我遇到了类似的情况,其中Show()
方法在程序
create
期间运行。我实现了OnActivate()
方法,并从那里调用Show()
方法,而不是从OnCreate()
调用。You could move the functions you don't want to run automatically during
create
from theOnCreate()
method. You may move them to e.g.OnClick()
. I faced a similar situation where aShow()
method was running during program
create
. I implemented theOnActivate()
method and called theShow()
method from there, instead fromOnCreate()
.