默认情况下,组合框jface显示字符串的结尾。如何显示长字符串的开始 [英] combobox jface showing end of string by default. How to show start of long string

查看:140
本文介绍了默认情况下,组合框jface显示字符串的结尾。如何显示长字符串的开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它是

推荐答案

通常你可以改变一个可编辑的 Combo / CCombo code> setSelection()。

Usually you shoud be able to change the selected text of an editable Combo/CCombo with setSelection().

例如

combo.setSelection( new Point( 0, 0 ) )


$ b combo.setSelection(new Point(0,0) $ b

会将插入符放在组合框的文本字段的开头。

would position the caret at the beginning of the text field of a combo box.

但是显然这不会在SWT上工作

But apparently this doesn't work (any more?) on SWT on Windows (haven't tried other platforms).

执行此程式码片段后,文字 begin end 选择。
此外,这看起来与文本的长度无关。这里整个文本适合Combo的宽度。您也可以用 Combo 替换 CCombo ,它们的行为都一样。

After executing this snippet, the text begin end remains entirely selected. Also, this is seemingly unrelated to the length of the text. Here the entire text fits the width of the Combo. You can also replace Combo with CCombo, they both behave the same.

shell.setLayout( new FillLayout( SWT.HORIZONTAL ) );
Combo combo = new Combo( shell, SWT.NONE );
combo.add( "begin end" );
combo.select( 0 );
combo.setSelection( new Point( 0, 0 ) );

我建议针对SWT 提出错误,并查看SWT维护者说的内容。

I'd suggest to file a bug against SWT and see what the SWT maintainers say.

这篇关于默认情况下,组合框jface显示字符串的结尾。如何显示长字符串的开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆