Textfield get selected text

Hi all… Exist some way to get only the selected text inside a textfield?
I dont see any methods to do that, and, searching on google, and in this forum, I dont see any information about that.

Many thanks!

Currently I’m afraid you cannot do that with an ordinary TextField, you can only set the selection (
#5217
)
Getting the text selection would make a nice enhancement though.

I also need this in my current project where we implement this functionality by context menu and we want the text that is selected by the client in label or textfield component my case for Label but unfortunatly nothing is there for the same while search the web i came a link of gwt-selection link https://code.google.com/p/gwt-selection/ which is gwt library for managing selection please provide some help how to implement this with label Thanks

Hi Jai,

you could extend your label (https://vaadin.com/book/vaadin7/-/page/gwt.extension.html) and make a RPC call when selection has been changed.
But actually I have no idea how this gwt-selection works. Maybe you have to write your own JavaScript with onselectstart and ondrop to get the selected text.

Good luck! I would be very happy you could share your results :slight_smile:

Hi Wolfgang
I have not used Vaadin7 our libs are built on Vaadin6 so if you put some light with Vaadin6 Impl that will be great

Hi Jai,

too bad I never created a vaadin6 component with client features. So I can’t help you too much

Here you can read the chapter how to build GWT components.
https://vaadin.com/book/vaadin6/-/page/gwt.html

In vaadin7 the workflow is increased drastically.