I have a strange issue.
I’ve subclassed a canvas and I’m trying to emulate a textbox, therefore using a timer to create a blinking cursor.
I have a timer(xojo.core.timer) as a private property of the canvas, the class’s constructor sets it up, adds the handler. Then, a mouse click down event will change the timer’s mode to multiple… should start the timer.
The handler simply flips a boolean value and then calls a method which draws the textbox with or without the cursor to a picture, Then, invalidate is called to Paint the picture.
Sub Handler(myTimer as Xojo.Core.Timer)
show = not show
DrawTextBox
//invalidate
end sub
If Invalidate is called from the Handler it works
If Invalidate is called inside DrawTextBox it seems to kill the timer.
Sub DrawTextBox()
Buffer = new picture(width, height)
dim g as Graphics
g = Buffer.Graphics
g.Draw...
//do stuff
if show then
//draw cursor...
end if
invalidate //this here seems to mess up the timer
end sub
Strange and Frustrating.
Lastly, I created a dumbed down version to try to reproduce it. Making the same calls and the same code flow. I can’t reproduce the behavior.
Any tips on how else to debug this?