ST3VO
asked on
Adding an event to a Button created at runtime
Hi all,
I am creating a close button at runtime. Create the button works fine but I now need to add an onclick event to when this button is clicked on, so I can close PageControl Active Pages. I just cannot get it to work.
How do I do this please?
Here is the current code I'm using below:
I am creating a close button at runtime. Create the button works fine but I now need to add an onclick event to when this button is clicked on, so I can close PageControl Active Pages. I just cannot get it to work.
How do I do this please?
Here is the current code I'm using below:
Button := TSpeedButton.Create(PageControl1);
Button.Parent := PageControl1;
Button.Top := 0;
Button.Left := PageControl1.Width - Button.Width;
Button.Caption:=('X');
// Button.OnClick := <-- This doesn't work
Button.Visible := True;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
ASKER
I had to share both as answers because although you both said the same thing, I had something else missing in my code which was added by Ferruccio68, so I've used both codes to get this working.
Don't consider mine as answer