请问如何在fastscript脚本中引用窗口的控件及其属性! 这样可以引用:
fastscript1.addclass(TDBEdit,'TCustomEdit');
可是加了之后其脚本却不能访问其属性,如DBEdit的Text属性
上面的ADDCLASS是一个函数,返回值为TfsClassVariable
可以这样定义
var
fsClassVar: TfsClassVariable;
begin
fsClassVar:=fastscript1.addclass(TDBEdit,'TCustomEdit');
fsClassVar.AddProperty(); //现在关键是这里面的参数怎么写?如何才能将其属性值加进去
end;
fastscript1.addclass(TDBEdit,'TCustomEdit');
可是加了之后其脚本却不能访问其属性,如DBEdit的Text属性
上面的ADDCLASS是一个函数,返回值为TfsClassVariable
可以这样定义
var
fsClassVar: TfsClassVariable;
begin
fsClassVar:=fastscript1.addclass(TDBEdit,'TCustomEdit');
fsClassVar.AddProperty(); //现在关键是这里面的参数怎么写?如何才能将其属性值加进去
end;
解决方案 »
- 在CHART中我在CANVAS画了一条竖线(可以左右移动) 我又添了一条曲线SERIES1 我如何才能取到两条线的焦点坐标呢??
- 可执行文件 问题???
- 这样的SQL语句怎么写?感觉有难度啊
- 关于生成bmp文件的问题
- 救救我,文件误删,回收站也没有了!怎么样才能恢复?100分相送,解决立即给分!!
- 关于拷贝的表达问题
- 如何将String变量赋给TTable变量中字段呢?
- 招聘Delphi 兼职程序员,要求有至少2年以上的开发经验,对电子书的开发能够胜任.
- 用ADOquery來更新后台數據庫的問題
- MEMO怎么删除我选择的行呢?
- 我要從表中選出除一個字段的所有記錄如何寫sql(在線等)
- 用过fastscript的请进,高分相送,up也有分!
在fs_iformsrtti.pas中
里面有已经添加的控件类
只要自己手动加进去就可以了
如加入TEXT属性
with AddClass(TDBEdit, 'TWinControl') do
begin
AddProperty('Text', 'String', GetProp, SetProp);
end;function TFunctions.GetProp(Instance: TObject; ClassType: TClass;
const PropName: String): Variant;
begin
Result := 0; if ClassType = TControl then
begin
if PropName = 'PARENT' then
Result := Integer(TControl(Instance).Parent)
end
else if ClassType = TCustomComboBox then
begin
if PropName = 'DROPPEDDOWN' then
Result := TCustomComboBox(Instance).DroppedDown
else if PropName = 'ITEMINDEX' then
Result := TCustomComboBox(Instance).ItemIndex
end
else if ClassType = TCustomListBox then
begin
if PropName = 'SELCOUNT' then
Result := TCustomListBox(Instance).SelCount
else if PropName = 'ITEMINDEX' then
Result := TCustomListBox(Instance).ItemIndex
end
else if ClassType = TCustomForm then
begin
if PropName = 'MODALRESULT' then
Result := TCustomForm(Instance).ModalResult
else if PropName = 'CANVAS' then
Result := Integer(TCustomForm(Instance).Canvas)
end
//以下为自己的添加的类添加get属性方法
else if ClassType = TDBEdit then
begin
if PropName = 'TEXT' then
Result := TDBEdit(Instance).Text;
end
end;procedure TFunctions.SetProp(Instance: TObject; ClassType: TClass;
const PropName: String; Value: Variant);
begin
if ClassType = TControl then
begin
if PropName = 'PARENT' then
TControl(Instance).Parent := TWinControl(Integer(Value))
end
else if ClassType = TCustomComboBox then
begin
if PropName = 'DROPPEDDOWN' then
TCustomComboBox(Instance).DroppedDown := Value
else if PropName = 'ITEMINDEX' then
TCustomComboBox(Instance).ItemIndex := Value
end
else if ClassType = TCustomListBox then
begin
if PropName = 'ITEMINDEX' then
TCustomListBox(Instance).ItemIndex := Value
end
else if ClassType = TCustomForm then
begin
if PropName = 'MODALRESULT' then
TCustomForm(Instance).ModalResult := Value
end
//以下为自己的添加的类添加Set属性方法
else if ClassType = TDBEdit then
begin
if PropName = 'TEXT' then
TDBEdit(Instance).Text := Value
end
end;