Simulating some Combo behavior for Text [message #631631] |
Fri, 08 October 2010 05:06  |
Eclipse User |
|
|
|
On OS Windows systems, the Combo widget
marks the current text, when entering it
even with a click.
I want to realize a similar behavior for
text widgets. I could solve part of the problem
by adding a FocusListener like this
myText.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
myText.selectAll();
}
});
This ensures that the text is selected when "tabbing" through all the
widgets within my composite. But it does not ensure that the text
becomes selected, when entering the widget *via* a mouse click,
which is something the Combo does on those systems.
Since I can observe that my focus observer is enetered even in
these situations, the reason could be that the mouse click
*follows* the focus enter event and does immediately "destroy" the just
realized selection.
Any ideas how to possibly realize the wanted behaviour preferrably via
the official API?
Thanks & Greetings from Bremen,
Daniel Krügler
|
|
|
|
Re: Simulating some Combo behavior for Text [message #631675 is a reply to message #631632] |
Fri, 08 October 2010 08:36  |
Eclipse User |
|
|
|
On 08.10.2010 11:09, Tom Schindl wrote:
> delay it with asyncExec?
That is a good suggestion, Tom. It seems to
mimic the behaviour in a reasoanble way (In
some situations the selection is incomplete,
i.e. only the characters "before" the mouse
click position are selected), I think I
can live with that state.
Thanks very much,
- Daniel
|
|
|
Powered by
FUDForum. Page generated in 0.04969 seconds