Hide iOS 9 external keyboard toolbar

I have successfully replaced TMemo with TTMSFMXMemo in a multidevice application, but have a problem with the external keyboard support in iOS 9 with iPad. When the user set focus on a edit control (here a TTMSFMXMemo) an annoying "assistant toolbar" (50 pixels high) pop ups . The  toolbar (introduced in iOS 9) comes with an Undo, a Redo and a Copy button, but none of these is linked to my memo control, so all buttons are dead. 


I would like to hide or remove this toolbar,  which seems to be quite simple in Objective-C ("OC") and Swift. On StackOverflow I found the following code snippets:

OC:
UITextInputAssistantItem* item = [self.textView inputAssistantItem];
item.leadingBarButtonGroups = @[];
item.trailingBarButtonGroups = @[];
 
Swift:
let item : UITextInputAssistantItem = yourTextView.inputAssistantItem
    item.leadingBarButtonGroups = []
    item.trailingBarButtonGroups = []

Some of these interfaces are missing in 10.1 Berlin (and older versions) but can be created with  the SDKTransform utilty included in Berlin. But still I don't know how translate the code above to Delphi.

Any help would be much appreciated!
 

Hi, 


The TTMSFMXMemo is not responsible for showing and hiding the keyboard assistant toolbar. The native view connected to a textservice handles this , but is unfortunately not accessible from within an application. Each editable component in FireMonkey is managed by the same text service instance (created inside FMX.Platform.iOS). The TTMSFMXMemo simply uses the FireMonkey drawing engine and control structure to show the contents / text on the form.

Pieter Scheldeman2016-08-31 16:49:11

Hi Pieter,


So what you say is that the relevant code is hidden inside FMX.Platform.iOS and used by TTMSFMXMemo and all other edit controls like TMemo, TEdit, etc. If I understand the OC/Swift-code I have to use the UITextView interface of the edit control,  In FMX.Memo.iOS I find TiOSNativeMemo with a public View: UITextView property, and if I set a Memo1.ControlType = Platform (here Memo1 is a TMemo), I can get to the textview interface by 

TiOSNativeMemo(Memo1.Presentation).View

And View has the inputAssistantItem interface property (NB! Not in the iOSapi.UIKit unit coming with current Delphi versions, I have to use the SDKTransform translator with  iOS 9x). 

But I don't know how to get to the UITextView interface with styled FMX controls (TMSFMXMemo, etc.). There has to be some way to tell iOS to not show this stupid toolbar - just 3 lines of code in OC and Swift! 

Inside FMX.Platform.iOS the TFMXViewBase class implements the UITextInput interface, so this differs from the native UITextView (platform vs styled) and it's unclear if the inputAssistantItem properties are available for this class. At first sight this seems to be an UITextView / UITextField property and not an UIView property. I would recommend asking Embarcadero about this, as this is a FireMonkey framework implementation that is being used for all editable styled controls that implement the ITextInput interface.

Thanks Pieter,


I got some ideas where to look further. With some luck, Emba will update their iOS interface in Berlin Update 1;)