简体   繁体   English

SWT文本字段从右到左的外观

[英]Right-To-Left appearance of SWT Text fields

I am expecting a weird problem with some of the Text fields in my Eclipse-RCP application: when I start typing text in these fields it appears in the reverse order (right-to-left). 我期望Eclipse-RCP应用程序中的某些 “文本”字段出现奇怪的问题:当我开始在这些字段中键入文本时,它以相反的顺序显示(从右到左)。 For instance: typing "hello", appears as "olleh". 例如:键入“ hello”,显示为“ olleh”。 Even if I put caret to the end of the text it will jump to the beginning, when typing next letter. 即使我将插入号放在文本的末尾,当键入下一个字母时,它也会跳到开头。

All fields are created in the same way, but not all of them have such strange behavior. 所有字段都以相同的方式创建,但并非所有字段都具有这种奇怪的行为。 If I right-click on the field and select "Show Unicode control characters" it does not show that there is a right-to-left bidi character. 如果我右键单击该字段并选择“显示Unicode控制字符”,则不会显示从右到左的比迪字符。

Has anyone expected something similar or have any clues of what is wrong with my application? 是否有人期望过类似的事情或对我的应用程序有什么错误的任何线索?

Try text.setOrientation(SWT.LEFT_TO_RIGHT) 尝试text.setOrientation(SWT.LEFT_TO_RIGHT)

Here is the Eclipse Documentation of Text . 这是Text的Eclipse文档 If this doesn't help, you might try reworking whatever layout you're using; 如果这样做没有帮助,您可以尝试重新使用所使用的任何布局; I can't be more specific without an example. 没有一个例子,我无法更具体。

The problem was solved, so, I am gonna post an answer, in case someone comes across the same problem. 问题已解决,因此,如果有人遇到相同的问题,我将发布答案。

Apparently, orientation was not changed to right_to_left. 显然,方向未更改为right_to_left。 Initial problem was, that during typing caret was jumping to the beginning of the text field (after each symbol). 最初的问题是,在键入插入符号期间,插入符号跳到了文本字段的开头(在每个符号之后)。 And the reason for such behavior was, that there were multiple Bindings created for one TextField (sub and parent classes were creating these bindings). 这种行为的原因是,为一个TextField创建了多个Bindings (子类和父类正在创建这些绑定)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM