Sub class events

Is there a way to sub class a control, use one of it’s events, but still expose that event to the form it’s placed on?
I thought I had seen an example of this in the past, but can’t seem to find it…


Yes. Let’s say you put code into the subclass’ Open event, preventing “Open” from appearing as a choice when you put that subclass into your window.

Define a custom event, “Open”, then put this into the code for the “real” Open event:

RaiseEvent Open()

Decide whether the code in the instance’s Open event should come before or after the subclass’ Open code, and place that line accordingly.

Thanks Kem, that got me in the right direction.
I was able to sub class the MouseDown and MouseUp events, but the Action event never fires. My workaround for this was to add a custom event Action and then RaiseEvent Action () in the mouseUp event, currently I am doing this after the RaiseEvent MouseUp ().
It seems to work but I don’t know if this is a good idea.
Why did the Action event stop firing after sub classing the mouse down and up events?


Which control?

It’s a BeveleButton

It sounds like you are returning “true” from MouseDown event in your subclass. As soon as you do that, Xojo expects you to take care of the mouse and won’t fire the Action event, so it’s up to you to recreate the proper functions. From what you describe, that’s what you’re doing.

Thanks Kem!