Jump to content
Sign in to follow this  
Janex72

Add Event in runtime

Recommended Posts

Hi All Experts!

 

I need to create Button in runtime and assign OnClick Event.

Create is easy and assign event to:

  MyNewButton.OnClick := MyOnClickEventProcedure;

 

For this I need to previously write procedure MyOnClickEventProcedure in code in designtime.

 

Is there some way to not permanently write MyOnClickEventProcedure in code, for example:

MyNewButton.OnClick := MyUniversalProcedureForAllEvents;

I don't yet know what events will be used during development.

Is this possible?

 

WBR

Janex

 

 

 

 

 

Share this post


Link to post

Your event handler must match the signature of the event to which you want to assign it. Many events are of the type TNotifyEvent, so this is the most versatile event signature. 

But I'm not sure I understand what exactly you want to achieve. Maybe a universal message handler would be a better fit for your purpose? But such a handler can not just be assigned.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×