fwatchproperties.pas

来自「Suite of components to add scripting cap」· PAS 代码 · 共 73 行

PAS
73
字号
unit fWatchProperties;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, atScript;

type
  TfmWatchProperties = class(TForm)
    Label1: TLabel;
    edExpression: TEdit;
    chEnabled: TCheckBox;
    btOk: TBitBtn;
    btCancel: TBitBtn;
    procedure btOkClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    FDebugWatches : TatDebugWatches;
    FDebugWatch : TatDebugWatch;
    procedure SetDebugWatch(const Value: TatDebugWatch);
  public
    { Public declarations }
    property DebugWatch: TatDebugWatch read FDebugWatch write SetDebugWatch;
    property DebugWatches: TatDebugWatches read FDebugWatches write FDebugWatches;
  end;

var
  fmWatchProperties: TfmWatchProperties;

implementation

{$R *.DFM}

{ TfmWatchProperties }

procedure TfmWatchProperties.SetDebugWatch(const Value: TatDebugWatch);
begin
  FDebugWatch := Value;
  if not Assigned(FDebugWatch) then
  begin
    { clear watch properties on the form }
    edExpression.Text       := '';
    chEnabled.Checked       := True;
  end
  else
  begin
    edExpression.Text       := FDebugWatch.Expression;
    chEnabled.Checked       := FDebugWatch.Enabled;
  end;
end;

procedure TfmWatchProperties.btOkClick(Sender: TObject);
begin
  if not Assigned(FDebugWatch) then
    FDebugWatch := FDebugWatches.Add;
  { save properties into debug watch item }
  with FDebugWatch do
  begin
    Expression    := edExpression.Text;
    Enabled       := chEnabled.Checked;
  end;
  FDebugWatches.Evaluate(FDebugWatch);
end;

procedure TfmWatchProperties.FormShow(Sender: TObject);
begin
  edExpression.SetFocus;
end;

end.

⌨️ 快捷键说明

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