Difference between revisions of "Creating LCL Control From Libraries"

From Lazarus wiki
Jump to navigationJump to search
(New page: == About == Due to several problems, LCL components and ansistrings cannot be passed between a library (dll/so/dynlib) and an application (exe/app). This interface provides a simple API b...)
 
Line 13: Line 13:
  
 
== LIBRARY EXAMPLE 2 ==
 
== LIBRARY EXAMPLE 2 ==
procedure init;
+
<code>procedure init;
 
var button:TRButton;
 
var button:TRButton;
 
begin
 
begin
Line 19: Line 19:
 
   button.Caption:='Hello!';
 
   button.Caption:='Hello!';
 
   button.Parent:=RParent;
 
   button.Parent:=RParent;
end;
+
end;</code>
  
 
== Copyright ==
 
== Copyright ==
Line 29: Line 29:
  
 
== License ==
 
== License ==
(C) 2009 Covac Software. You may copy, store, modify and sell this software as long as you keep copyright comments in the source code.
+
&copy; 2009 Covac Software. You may copy, store, modify and sell this software/source as long as you keep copyright comments in the source code intact.
  
 
<!-- Still a learner, need this link for the future: http://www.mediawiki.org/wiki/Help:Formatting -->
 
<!-- Still a learner, need this link for the future: http://www.mediawiki.org/wiki/Help:Formatting -->

Revision as of 01:29, 28 October 2009

About

Due to several problems, LCL components and ansistrings cannot be passed between a library (dll/so/dynlib) and an application (exe/app).

This interface provides a simple API between the library and the application to create LCL UI controls application-side, however controlled by dummies library-side.

LIBRARY EXAMPLE 1

procedure init; var myobj:TRHandle; begin

 myobj:=RCreate(StrToRstr('TObject'));
 RSetStrProp(myobj,StrToRstr('MyStringProperty'),StrToRstr('Hello world!'));

end;

LIBRARY EXAMPLE 2

procedure init; var button:TRButton; begin

 button:=TRButton.Create(RApplication);
 button.Caption:='Hello!';
 button.Parent:=RParent;

end;

Copyright

Devised and created by Christian Sciberras, with the help of the following people from #lazarus-ide IRC (alphabetical):

  • Andreas '\pub\bash0r' Schneider
  • Dmitry 'skalogryz' Boyarintsev
  • Marc 'giantm' Weustink
  • Vincent 'fpcfan' Snijders

License

© 2009 Covac Software. You may copy, store, modify and sell this software/source as long as you keep copyright comments in the source code intact.