


Procedure TForm1.Button1Click(Sender: TObject) Let's get a tiny project running before the actual sample project.Ĭreate a new Application Project (Project->New Project->Application->OK).ĭraw a TButton on the form. Procedure TForm1.btnClickEvent(Sender: TObject) Set properties to it (just like we always do in the Object Inspector->Properties):Īdditionally if you want to have an event attached to it, just point a procedure to the event:ītn.OnClick := btnClickEvent might be like this: Create an instance of the component classģ. So, we have 3 steps to creating a component on the fly (or in the runtime):ġ. Let's see this sample code for creating buttons: If you want to add some event to it, it's easy as well. We create an instance of class of the component and then more gracefully give some properties to it. Creating components are just dead simple. If you are scared that the code might be difficult, don't worry. Be sure to check that out if you're interested.
#Free pascal random 255 how to
Before this article, LazPlanet had another article quite similar to this: How to clone your forms into many. Today we are going to learn how to create Buttons, Labels, Edits right at the time when the exe is running.īefore getting our hands dirty, let's get our basics straight. The good thing about programming is that you can do almost anything you wish.
