In the desktop version of my editor, the caret stops blinking when the canvas no longer has the focus. I set the the focus when the canvas is clicked on.
The only events I can see that are relevant are KeyDown and TextReceived. However relying on those means the caret won’t get activated until after a key is pressed…
Internally within my control I have a Timer that fires (to draw the caret) that checks a boolean property to see if the canvas has the focus. On desktop I set this in the FocusReceived event but there isn’t an equivalent for iOS.
ok, so after doing a little hacking, The common wisdom (even in Obj-C) seems to be to put an invisible text control on the view and use the events from that control.
I was able to hack a MobileContainer to respond correctly to a request to “becomeFirstResponder” but the underlying control itself never really did and doesn’t seem to fire the events anyway.
Thanks for taking a look at this but crikey, what an ugly workaround.
There are two scenarios where I would want the caret/insertion point to be blinking in a code editor:
When the on-screen keyboard is displayed. As far as I can see, there is no event in the iOS framework that fires when the keyboard is presented or dismissed. Do you know of one?
If an external keyboard is attached to the iPad. In this scenario I’d want to know one was present and always blink the caret.