我可以设置inputType下到" textCapSentences"德尔福XE5 [英] Can I set InputType to "textCapSentences" Delphi XE5
问题描述
我要大写首字母的句子,然后输入用户字符串编辑就像我可以在Eclipse中做到这一点:机器人:inputType下=textCapSentences
I need to capitalize first letter In sentences then user typing string in Edit like I can do it in Eclipse : "android:inputType="textCapSentences"
我怎样才能做到这一点在XE5?
How can I do it in XE5?
或可能是一些其他的方式来改变偏移状态虚拟键盘上的XE5?
Or may be some other way to change Shift status on virtual keyboard in XE5?
推荐答案
的 textCapSentences
对应的<一个href=\"http://developer.android.com/reference/android/text/InputType.html#TYPE_TEXT_FLAG_CAP_SENTENCES\"相对=nofollow> TYPE_TEXT_FLAG_CAP_SENTENCES
常数是 的TextView
Android的类。这个类是由 Androidapi.JNI.Widget.JTextView
界面进行包装,而这是不被Firemonkey TEDIT直接控制使用,而Firemonkey使用名为<$ C $代理类C> JFMXTextEditorProxy 。因此在理论上,你必须访问链接到EditControl设置使用 setEnterAction
方法的value TYPE_TEXT_FLAG_CAP_SENTENCES
代理类。不幸的是,实例添加到该代理类在 TTextServiceAndroid
这是在执行部分定义的类的 FMX.Platform.Android $ c为微胶囊$ C>单元,所以无法访问即可。因此,这,我想起唯一的选择就是使用
的onkeydown
事件,如:
The textCapSentences
Corresponds to the TYPE_TEXT_FLAG_CAP_SENTENCES
constant which is part of the TextView
Android Class. This class is wrapped by the Androidapi.JNI.Widget.JTextView
interface but this is not used directly by the Firemonkey TEdit controls, instead Firemonkey uses a proxy class called JFMXTextEditorProxy
. so in theory you must access the proxy class linked to the EditControl to set the value TYPE_TEXT_FLAG_CAP_SENTENCES
using the setEnterAction
method. unfortunately the instance to this proxy class is encapsuled in the TTextServiceAndroid
class which is defined in the implementation part of the FMX.Platform.Android
unit, so can't be accessed. So the only option which come to my mind is use the OnKeyDown
event like :
这将大写的EditText上的第一个字母和任何一个空格字符之后。
This will Capitalize the first letter of the EditText and any after a space character.
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
begin
if (TEdit(Sender).Text.Length=0) or ((TEdit(Sender).Text.Length>0) and TEdit(Sender).Text.EndsWith(' ')) then
KeyChar:=UpCase(KeyChar);
end;
这篇关于我可以设置inputType下到&QUOT; textCapSentences&QUOT;德尔福XE5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!