[Lazarus] how to modify or add component after Application.Run method?

Mr Bee pak.lebah at yahoo.com
Sun Jan 24 09:45:48 CET 2016


Hi,
Common Lazarus project source code contains this snippet:
begin  Application.Initialize;
  Application.CreateForm(TForm, Form1);  Application.Run;end. 

Adding code to modify or add components of/into Form1 after the Application.Run method will be ignored because it's out of the application's main thread. So, is there a correct and safe way to do it?
begin  Application.Initialize;
  Application.CreateForm(TForm, Form1);  Application.Run;  // how to make below code be executed?  Form1.Caption := 'My caption';  Form1.Edit1.Text := 'My text input';  MyLabel := TMyLabel.Create(Form1);  MyLabel.Parent := Form1;  MyLabel.Caption := 'My runtime label';  // or one could add any arbitraty code hereend. 
 Thank you. :)
Regards,
–Mr Bee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160124/9e42809b/attachment-0002.html>


More information about the Lazarus mailing list