[Pas2js] compound component

warleyalex warleyalex at yahoo.com.br
Tue May 22 14:36:34 CEST 2018


I'm trying to mimic component template.
Do you know how to paste a text clipboard intoto Lazarus IDE designer?

var 
    Src : TStrings;
    h: HWND;
begin
  Src:=TStringList.Create;
  try
    with Src do
    begin
      Add('object Panel1: TPanel');
      Add('Left = 14');
      Add('Height = 69');
      Add('Top = 31');
      Add('Width = 558');
      Add('Caption = ''Panel1''');
      Add('ClientHeight = 69');
      Add('ClientWidth = 558');
      Add('TabOrder = 0');
      Add('object Button1: TButton');
      Add('Left = 37');
      Add('Height = 25');
      Add('Top = 24');
      Add('Width = 75');
      Add('Caption = ''Button1''');
      Add('TabOrder = 0');
      Add('end');
      Add('object Button2: TButton');
      Add('Left = 248');
      Add('Height = 25');
      Add('Top = 24');
      Add('Width = 75');
      Add('Caption = ''Button2''');
      Add('TabOrder = 1');
      Add('end');
      Add('object Button3: TButton');
      Add('Left = 472');
      Add('Height = 25');
      Add('Top = 24');
      Add('Width = 75');
      Add('Caption = ''Button3''');
      Add('TabOrder = 2');
      Add('end');
      Add('end');
    end;
    Clipboard.AsText := Src.Text;
  finally
    Src.Free;
  end;

h := FindWindow('window', nil);
h := FindWindowEx(h, 0, 'window', nil);
SetForegroundWindow(h);

//SendMessage(Panel1.Handle, WM_SETTEXT, 0,
Longint(PChar(Clipboard.AsText)));

PostMessage(h, WM_PASTE, 0, Longint(PChar(Clipboard.AsText)));






--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list