As a direct result of user feedback, starting with Xojo 2023r2, the MobileCanvas control on iOS can now receive KeyDown events from the user, both from the on-device keyboard and any connected keyboard. In addition, this support is available in MobileTextArea, MobileTextField and MobileScreen.
In order for the MobileCanvas to receive KeyDown events, the control instance needs to be Enabled and have its focus set. In addition, the new AllowKeyEvents property needs to be set to True.
If the Canvas receives the KeyDown event, the on-device keyboard will be hidden as soon its focus is cleared or the control Enabled property is set to False.
In addition to the new KeyDown event, there is also a new TextReceived event that, if implemented in the instance, will be fired when the control receives, for example, text from the Dictation feature when the text is more than just one character in length.
Lastly, while MobileCanvas, MobileTextField and MobileTextArea can only receive KeyDown events, the MobileScreen object can also receive KeyUp events. See this in action in this short video: KeyDown events on MobileCanvas on iOS.
Javier Menendez is an engineer at Xojo and has been using Xojo since 1998. He lives in Castellón, Spain and hosts regular Xojo hangouts en español. Ask Javier questions on Twitter at @XojoES or on the Xojo Forum.