I have a TToolBar created in design time with no ToolButtons. My idea is to create ToolButtons in runtime and place them there when my forms are created, just to show the us
From the comments it is clear that you are not assigning a TNotifyEvent
to the OnClick
event. The declaration of TNotifyEvent
is:
TNotifyEvent = procedure(Sender: TObject) of object;
So you need a procedure, with a single parameter of type TObject
, and the procedure must be the method of an object. So, something like this:
procedure TMyForm.ToolButtonClick(Sender: TObject);
And then you can assign it like so:
NewToolButton.OnClick := ToolButtonClick;