在delphi 7中做一个向导界面 [英] making a wizard interface in delphi 7

查看:217
本文介绍了在delphi 7中做一个向导界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用delphi 7,我正在尝试做一个向导界面。我不知道是否有更简单的方法来制作向导,所以我正在考虑为向导的每个步骤制作单独的表单,当用户点击下一步时,活动窗体关闭,下一个打开。 / p>

以下是两个连续表单的屏幕截图:



我做了一个以2个表单为参数的过程:将关闭的表单和向导的下一个表单

 类过程Tspad.nextForm(showForm,closeForm:TForm); 
begin
closeForm.Close;
showForm.Showmodal;
结束

当我点击下一步按钮执行以下代码:

  Tspad.nextForm(echipContractForm,clientContractForm); 

当我运行程序,我按下下一步按钮,下一个窗体呵呵



我如何使这项工作,或者还有另一种更有效的方式来创建向导?

解决方案

制作向导的一个很常见的方法是使用页面控件。向导的每个不同页面是页面控件中的不同页面/选项卡。我相信这是Windows实现向导的有效方式。



当然,你想隐藏所有的选项卡。通过将 TabVisible 设置为每个标签页的 False 来执行此操作。当您希望通过向导向前和向后移动时,例如当用户单击下一个或上一个按钮时,通过根据您的偏好设置 ActivePage ActivePageIndex 来实现此功能。 p>

I'm using delphi 7 and I'm trying to make a wizard interface. I don't know if there is an easier way to make a wizard, so I was thinking of making separate forms for each step of the wizard, and when the user clicks "Next" the active form closes and the next one opens.

Here's a screen-shot of two successive forms:

I've made a procedure that take 2 forms as parameters: the form that will be closed and the next form of the wizard

class Procedure Tspad.nextForm(showForm, closeForm: TForm);
begin
   closeForm.Close;
   showForm.Showmodal;
end;

When I click the "Next" Button the folowing code is executed:

Tspad.nextForm(echipContractForm, clientContractForm);

When i run the program, and i press the "Next" button, the next form apeares but the curent one dosen't close.

How can i make this work, or is there another more efficient way to create a wizard?

解决方案

One very common way to make a wizard is to use a page control. Each distinct page of the wizard is a different page/tabsheet in the page control. I believe that this is effectively how Windows implements wizards.

Naturally you want to hide all the tabs. Do this by setting TabVisible to False for each tabsheet. When you wish to move forwards and backwards through the wizard, e.g. when the user clicks the next or previous buttons, effect this by setting ActivePage or ActivePageIndex depending on your preference.

这篇关于在delphi 7中做一个向导界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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