请问如何在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;
解决方案 »
- 如何调用“控件”的事件过程,请高手指点。
- 有志创业者,参加赢在中国的进啊!
- 用程序加入FLASH后,SWF文件之间还可以互相调用吗?
- VC 能否引用Dephi的动态库?
- 使用两个ADOConnection分别连接两个异构数据库,如何用sql语句进行数据的导入/导出工作?
- 如何才能叫斑竹封了那个乱吠的IShellFolder()?
- 请各位指点Delphi中的字符串处理函数?在线等候
- 如何实现一个小的底层问题?
- 主细结构,,,,table_table,query_table 可以配合,怎样把query-query配合呀。
- 怎样对动态生成的Timaget控件进行操作????
- 用过fastscript的请进,高分相送,up也有分!
- 我想做一个edit组件,请问edit在窗体设计是改变他的大小时,产生哪个事件?
在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;