I’ve created an own listbox subclass. When I add my subclass to a window, the eventhandlers that I used in the subclass have disappeared. Some like the Open event I can make available by typing Open at the end of the code in the subclass.Open event. But most others don’t work that way. Is there a way to revoke cellClick or CellBackgroundPaint? Thanks.
To “pass the event forward”, you need to add an EventDefinition to your subclass and then re-raise that event in your code.
Thanks Tim. Can’t find anyting on EventDefinition in the docs. Can you give an example? Thanks.
An overview of Event Definitions:
Event Definitions show up as Events for instances of your subclass. So when you want an Event to occur you raise the Event Definition. There’s a little information here
So in your subclass, add an Event Definition: Open
Then at the end of your Event Handler for Open, add RaiseEvent Open
Your subclass will now have an Open event, and it will get triggered
This works for whatever you name the event, it doesn’t have to be an existing Xojo Event.
Got it! Thanks a lot.