1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- unit ec_labelbase;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Buttons,
- StdCtrls, ec_base;
- type
- { TECLabelBaseFrame }
- TECLabelBaseFrame = class(TECBaseFrame)
- LabelNameEdit: TEdit;
- LabelNameLabel: TLabel;
- procedure FormShow(Sender: TObject);
- public
- function GetCommandCode: Integer; virtual;
- procedure InitExisting; override;
- procedure MakeResultingCommand; override;
- end;
- var
- ECLabelBaseFrame: TECLabelBaseFrame;
- implementation
- uses
- fpjson;
- {$R *.lfm}
- { TECLabelBaseFrame }
- procedure TECLabelBaseFrame.FormShow(Sender: TObject);
- begin
- LabelNameEdit.SetFocus;
- end;
- function TECLabelBaseFrame.GetCommandCode: Integer;
- begin
- GetCommandCode := 0;
- raise ENotImplemented.Create('Called GetCommandCode of TECLabelBaseFrame');
- end;
- procedure TECLabelBaseFrame.InitExisting;
- var
- Params: TJSONArray = nil;
- LabelName: String = '';
- begin
- Params := GetFirstParams;
- if (Params <> nil) and (Params.Count >= 1) and (Params[0].JSONType = jtString)
- then
- LabelName := Params[0].AsString;
- LabelNameEdit.Text := LabelName;
- end;
- procedure TECLabelBaseFrame.MakeResultingCommand;
- begin
- ResultingCommand := SingleLineResultingCommand(
- GetCommandCode,
- TJSONArray.Create([
- LabelNameEdit.Text
- ])
- );
- end;
- end.
|