You can right mouse click on “Timer” (after “New”) then from the context menu select “New method” > “From event” and it will create the action event with the correct signature for you.
Then AddHandler MyTimer.Action, AddressOf TimerAction
should work after it.
p.s. the Autocomplete for this is broken for years. (as @Jeremy_Jefferies noted)
The Function you are adding with “AddressOf TimerAction” - needs to have a “sender as timer” added to its parameters. (As shown in the screenshot below.
If MyTimer already has an action assigned to it you will have to call removehandler beforehand in order to replace its action with the new function.
Adding the Timer to the window auto creates the timer, so the MyTimer = new Timer() is not needed.
If you are doing it this way just right click on the timer and add event handler → Action and Xojo will add the event handler for you.
Either do it entirely as a property as Jeremy says, or do it through the GUI, best not doing it half and half.
If you do it as a property, remember to RemoveHandler as well when all done with it as it will fire after your window has closed.