unit UfrmMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
uniGUIClasses, uniGUIRegClasses, uniGUIForm, uniMemo, uniGUIBaseClasses,
uniPanel, uniButton, uniEdit, uniTimer;
type
TfrmMain =
class(TUniForm)
pnlTop: TUniPanel;
mmoInput: TUniMemo;
btnSend: TUniButton;
btnClear: TUniButton;
btnClose: TUniButton;
procedure btnClearClick(Sender: TObject);
procedure btnSendClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure UniFormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function frmMain: TfrmMain;
implementation
{$R *.dfm}
uses
uniGUIVars, MainModule, uniGUIApplication,
Vcl.Clipbrd;
function frmMain: TfrmMain;
begin
Result := TfrmMain(UniMainModule.GetFormInstance(TfrmMain));
end;
procedure TfrmMain.btnClearClick(Sender: TObject);
begin
mmoInput.Lines.Clear;
SetActiveControl(mmoInput);
end;
procedure TfrmMain.btnCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmMain.btnSendClick(Sender: TObject);
var
S:
String;
CB: TClipboard;
P: TPoint;
H: THandle;
begin
S := mmoInput.Lines.Text;
if Copy(S, Length(S) - 1, 2) = #13#10
then begin
Delete(S, Length(S) - 1, 2);
end;
CB := TClipboard.Create;
try
CB.AsText := S;
finally
CB.Free;
end;
GetCursorPos(P);
H := WindowFromPoint(P);
if H > 0
then begin
PostMessage(H, WM_PASTE, 0, 0);
end;
end;
procedure TfrmMain.UniFormShow(Sender: TObject);
begin
SetActiveControl(mmoInput);
end;
initialization
RegisterAppFormClass(TfrmMain);
end.