关于CnOptionGroup使用的问题,请多多指教!
我创建一个类:以下是代码
unit GmConfig;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls;
type
TGmConfig = class(TObject)
private
{ Private declarations }
FDate: TDate;
FIntValue: Integer;
procedure SetDate(const Value: TDate);
public
{ Public declarations }
property Date: TDate read FDate write SetDate;
property IntValue: Integer read FIntValue write FIntValue;
end;
implementation
procedure TGmConfig.SetDate(const Value: TDate);
begin
FDate := Value;
end;
end.
以下是测试代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, CnAOTreeView, CnAutoOption, RzButton,GmConfig;
type
TForm1 = class(TForm)
CnAOTreeView1: TCnAOTreeView;
RzBitBtn1: TRzBitBtn;
procedure RzBitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.RzBitBtn1Click(Sender: TObject);
var Option: TCnOptionGroup;
gm:TGmConfig;
begin
Option := TCnOptionGroup.Create(nil);
gm:=TGmConfig.Create();
gm.IntValue:=1;
gm.Date:=Now;
Option.Text := '自动参数设置演示程序';
with Option.AddGroup('配置参数测试') do
begin
AddItem(gm,'intvalue','数据');
AddItem(gm,'date','日期');
end;
CnAOTreeView1.Options := Option;
end;
end.
现在的问题是运行下划线的语句时就出现错误,不知什么原因?请高手多多指教!
|