关于Delphi向导界面的制作
上来以为没啥啊,就按网上下载的pdf来做,谁知上机一调试就报错!于是结合网上说的,自己又琢磨了调试了几次就得到了下面的结论:
unit 以向导方式生成按键2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.ComCtrls, sPageControl, Vcl.StdCtrls, sCheckBox, sGroupBox, sRadioButton,
sButton, sComboBox, sLabel, sMemo;
type
TForm2 = class(TForm)
sPageControl1: TsPageControl;
sTabSheet1: TsTabSheet;
sTabSheet2: TsTabSheet;
sTabSheet3: TsTabSheet;
sGroupBox1: TsGroupBox;
sCheckBox1: TsCheckBox;
sCheckBox2: TsCheckBox;
sCheckBox3: TsCheckBox;
sGroupBox2: TsGroupBox;
sRadioButton1: TsRadioButton;
sRadioButton2: TsRadioButton;
sButton1: TsButton;
sGroupBox3: TsGroupBox;
sRadioButton3: TsRadioButton;
sRadioButton4: TsRadioButton;
sGroupBox4: TsGroupBox;
sRadioButton5: TsRadioButton;
sRadioButton6: TsRadioButton;
sButton2: TsButton;
sComboBox1: TsComboBox;
sComboBox2: TsComboBox;
sCheckBox4: TsCheckBox;
sGroupBox6: TsGroupBox;
sGroupBox5: TsGroupBox;
sRadioButton7: TsRadioButton;
sRadioButton8: TsRadioButton;
sComboBox3: TsComboBox;
sComboBox4: TsComboBox;
sGroupBox28: TsGroupBox;
sCheckBox5: TsCheckBox;
sCheckBox6: TsCheckBox;
sCheckBox7: TsCheckBox;
sCheckBox8: TsCheckBox;
sCheckBox9: TsCheckBox;
sCheckBox10: TsCheckBox;
sCheckBox11: TsCheckBox;
sCheckBox12: TsCheckBox;
sCheckBox13: TsCheckBox;
sCheckBox14: TsCheckBox;
sLabel3: TsLabel;
sGroupBox30: TsGroupBox;
sMemo27: TsMemo;
procedure sButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure sButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
MouseTimes: Integer; //用于记录【下一步按钮】点击的次数
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
MouseTimes := 0;
end;
procedure TForm2.sButton1Click(Sender: TObject); //第1次点击【下一步按钮时】
begin
sTabSheet1.TabVisible := False;
sTabSheet2.TabVisible := True;
sPageControl1.Activepage := Form2.sTabSheet2;
sButton1.Caption := '完成';
sButton2.Visible := True;
MouseTimes := MouseTimes + 1;
//ShowMessage(IntToStr(MouseTimes));
if (MouseTimes > 1) and (sButton1.Caption = '完成') then //if (MouseTimes > 1)显然这么写不对了
{所以正确的写法是sTabSheet2.TabVisible = True 或 被sTabSheet2被激活时 and (sButton1.Caption = '完成') then
才去执行生成代码! sPageControl1.ActivePage:=sTabSheet2
}
begin
// ShowMessage('按钮被点击!' + #13#10 + '这里写2-1生成的代码');
if sRadioButton1.Checked = True then
begin
ShowMessage('1111');
end;
if sRadioButton2.Checked = True then
begin
// ShowMessage('sRadioButton2被选中!');
sTabSheet3.TabVisible := True;
sTabSheet2.TabVisible := False;
sTabSheet1.TabVisible := False;
sButton1.Caption := '完成'
end;
//这里再写第一页中4个CheckBox的判断
//再写第2页中的内容
end;
//ShowMessage('over');
end;
procedure TForm2.sButton2Click(Sender: TObject); //点击【上一步按钮时】
begin
sTabSheet1.TabVisible := True;
sTabSheet2.TabVisible := False;
sTabSheet3.TabVisible := False;
sButton1.Caption := '下一步';
sButton2.Visible := False;
end;
end.
其实感觉吧,
MouseTimes: 记录【下一步按钮】点击的次数
也没啥用啊
不如判断TabSheet激活+Button1.caption='完成' 来得更直接 学习中,感谢分享。 学习delphi!
页:
[1]