⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fs_iformsrtti.pas

📁 报表源码 FastReport 3 is new generation of the report generators components. It consists of report engin
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      AddProperty('Parent', 'TWinControl', GetProp, SetProp);
      AddMethod('procedure Hide', CallMethod);
      AddMethod('procedure Show', CallMethod);
      AddMethod('procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer)', CallMethod);
      AddEvent('OnCanResize', TfsCanResizeEvent);
      AddEvent('OnClick', TfsNotifyEvent);
      AddEvent('OnDblClick', TfsNotifyEvent);
      AddEvent('OnMouseDown', TfsMouseEvent);
      AddEvent('OnMouseMove', TfsMouseMoveEvent);
      AddEvent('OnMouseUp', TfsMouseEvent);
      AddEvent('OnResize', TfsNotifyEvent);
    end;
    with AddClass(TWinControl, 'TControl') do
    begin
      AddMethod('procedure SetFocus', CallMethod);
      AddEvent('OnEnter', TfsNotifyEvent);
      AddEvent('OnExit', TfsNotifyEvent);
      AddEvent('OnKeyDown', TfsKeyEvent);
      AddEvent('OnKeyPress', TfsKeyPressEvent);
      AddEvent('OnKeyUp', TfsKeyEvent);
    end;
    AddClass(TCustomControl, 'TWinControl');
    AddClass(TGraphicControl, 'TControl');
    AddClass(TGroupBox, 'TWinControl');
    AddClass(TLabel, 'TWinControl');
    AddClass(TEdit, 'TWinControl');
    AddClass(TMemo, 'TWinControl');
    with AddClass(TCustomComboBox, 'TWinControl') do
    begin
      AddProperty('DroppedDown', 'Boolean', GetProp, SetProp);
      AddProperty('ItemIndex', 'Integer', GetProp, SetProp);
      AddEvent('OnChange', TfsNotifyEvent);
      AddEvent('OnDropDown', TfsNotifyEvent);
      AddEvent('OnCloseUp', TfsNotifyEvent);
    end;
    AddClass(TComboBox, 'TCustomComboBox');
    AddClass(TButton, 'TWinControl');
    AddClass(TCheckBox, 'TWinControl');
    AddClass(TRadioButton, 'TWinControl');
    with AddClass(TCustomListBox, 'TWinControl') do
    begin
      AddProperty('ItemIndex', 'Integer', GetProp, SetProp);
      AddProperty('SelCount', 'Integer', GetProp, nil);
      AddIndexProperty('Selected', 'Integer', 'Boolean', CallMethod);
    end;
    AddClass(TListBox, 'TCustomListBox');
    AddClass(TControlScrollBar, 'TPersistent');
    AddClass(TScrollingWinControl, 'TWinControl');
    AddClass(TScrollBox, 'TScrollingWinControl');
    with AddClass(TCustomForm, 'TScrollingWinControl') do
    begin
      AddMethod('procedure Close', CallMethod);
      AddMethod('procedure Hide', CallMethod);
      AddMethod('procedure Show', CallMethod);
      AddMethod('function ShowModal: Integer', CallMethod);
      AddEvent('OnActivate', TfsNotifyEvent);
      AddEvent('OnClose', TfsCloseEvent);
      AddEvent('OnCloseQuery', TfsCloseQueryEvent);
      AddEvent('OnCreate', TfsNotifyEvent);
      AddEvent('OnDestroy', TfsNotifyEvent);
      AddEvent('OnDeactivate', TfsNotifyEvent);
      AddEvent('OnHide', TfsNotifyEvent);
      AddEvent('OnPaint', TfsNotifyEvent);
      AddEvent('OnShow', TfsNotifyEvent);
      AddProperty('Canvas', 'TCanvas', GetProp, nil);
      AddProperty('ModalResult', 'Integer', GetProp, SetProp);
    end;
    AddClass(TForm, 'TCustomForm');
    AddClass(TDataModule, 'TComponent');
    with AddClass(TApplication, 'TComponent') do
    begin
      AddMethod('procedure Minimize', CallMethod);
      AddMethod('procedure ProcessMessages', CallMethod);
      AddMethod('procedure Restore', CallMethod);
      AddProperty('ExeName', 'String', GetProp, nil);
    end;
    AddObject('Application', Application);

    AddedBy := nil;
  end;
end;

destructor TFunctions.Destroy;
begin
  if fsGlobalUnit <> nil then
    fsGlobalUnit.RemoveItems(Self);
  inherited;
end;

function TFunctions.CallMethod(Instance: TObject; ClassType: TClass;
  const MethodName: String; var Params: Variant): Variant;
var
  Form: TCustomForm;
begin
  Result := 0;

  if ClassType = TControl then
  begin
    if MethodName = 'HIDE' then
      TControl(Instance).Hide
    else if MethodName = 'SHOW' then
      TControl(Instance).Show
    else if MethodName = 'SETBOUNDS' then
      TControl(Instance).SetBounds(Params[0], Params[1], Params[2], Params[3])
  end
  else if ClassType = TWinControl then
  begin
    if MethodName = 'SETFOCUS' then
      TWinControl(Instance).SetFocus
  end
  else if ClassType = TCustomListBox then
  begin
    if MethodName = 'SELECTED.GET' then
      Result := TCustomListBox(Instance).Selected[Params[0]]
    else if MethodName = 'SELECTED.SET' then
      TCustomListBox(Instance).Selected[Params[0]] := Params[1]
  end
  else if ClassType = TCustomForm then
  begin
    Form := TCustomForm(Instance);
    if MethodName = 'CLOSE' then
      Form.Close
    else if MethodName = 'HIDE' then
      Form.Hide
    else if MethodName = 'SHOW' then
      Form.Show
    else if MethodName = 'SHOWMODAL' then
      Result := Form.ShowModal;
  end
  else if ClassType = TApplication then
  begin
    if MethodName = 'MINIMIZE' then
      TApplication(Instance).Minimize
    else if MethodName = 'PROCESSMESSAGES' then
      TApplication(Instance).ProcessMessages
    else if MethodName = 'RESTORE' then
      TApplication(Instance).Restore
  end
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
  else if ClassType = TApplication then
  begin
    if PropName = 'EXENAME' then
      Result := TApplication(Instance).ExeName
  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
end;



initialization
  Functions := TFunctions.Create;

finalization
  Functions.Free;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -