When subclassing, every now and then I run into a situation where I would like to use an event from some other control.
Today I ran into this example.
I Subclassed a canvas that goes to work when the window is being resized. (It repositions itself based on other control positions.)
The Window.Resizing event fires when all controls have drawn and that’s perfect but this means that I need to call my Subclass.Update method from the Windows.Resizing event.
I’m looking for a way to handle it in the subclass itself and not let the window fire the update method.
In the Paint event, I tried checking if the Window.Height or Window.Width has changed. If so, I call the Update method. But this is triggered in the middle of redrawing the controls and not at the same moment as the Window.Resizing event.
The same goes when using a timer or CallLater.
So the Window.Resizing event fires at the perfect moment but I’m trying to let the Subclass figure it out instead of triggering it from Windows.Resizing.
Is there an ‘addHandler’ -way that my SubClass can use to somehow tap into another controls event? So in this case, the Window.Resizing event?