请问如何在fastscript脚本中引用窗口的控件及其属性!  这样可以引用:
fastscript1.addclass(TDBEdit,'TCustomEdit');
可是加了之后其脚本却不能访问其属性,如DBEdit的Text属性
上面的ADDCLASS是一个函数,返回值为TfsClassVariable
可以这样定义
var
fsClassVar: TfsClassVariable; 
begin
  fsClassVar:=fastscript1.addclass(TDBEdit,'TCustomEdit');
  fsClassVar.AddProperty();  //现在关键是这里面的参数怎么写?如何才能将其属性值加进去
end;

解决方案 »

  1.   

    修改其源文件
    在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;