TextEditor.setSelectAllWhenFocused() request


#1

Hi.

When setting setSelectAllWhenFocused() to true, the text does not get deselected upon leaving the TextEditor.
From my experience in most cases there’s no use in keeping the text highlighted and it looks weird to have all the fields’ text selected.

Will it be possible to add a boolean to state whether you’d like the text to also get deselected upon losing focus?
Currently I am using globalFocusChanged().

Thanks.


#2

Hmm… text editors do generally remember what’s highlighted when you change focus to other windows, which is why I did it like that (e.g. if a modal dialog appeared while you were in the middle of highlighting something, you’d want to be able to go back and carry on when you’ve dismissed it). But maybe you mean that it’s odd when there are multiple text editors on the page, as it seems intuitive that only the last one you used should remember its highlighting? (Not sure how I’d do that, since if you create a bunch of editors, they don’t know of each other’s existence).

(You might also want to use a Label instead, which would avoid all these ambiguities)


#3

[quote=“jules”]Hmm… text editors do generally remember what’s highlighted when you change focus to other windows, which is why I did it like that (e.g. if a modal dialog appeared while you were in the middle of highlighting something, you’d want to be able to go back and carry on when you’ve dismissed it). But maybe you mean that it’s odd when there are multiple text editors on the page, as it seems intuitive that only the last one you used should remember its highlighting? (Not sure how I’d do that, since if you create a bunch of editors, they don’t know of each other’s existence).

(You might also want to use a Label instead, which would avoid all these ambiguities)[/quote]

Well, I’ve played with some Microsoft Windows settings forms with TextEditors in them in order to affirm it and it seems that on Windows, at least, TextEditors clear their highlighted regions upon losing focus (and not necessarily to another TextEditor, but to any control); I guess that’s why an inactive TextEditor with highlighted text in it seems weird to me.

Is it different on Mac OS?


#4

Try it in a browser - if you have multiple windows, most of them will remember what’s selected in each one. Might be an OSX/windows difference too though.


#5

Well that’s not the same case; you can consider every browsing tab as a difference workspace, hence containing its own selection.
Try having more than one TextEditor with selected text in it on any website (Like Gmail’s advance search options, for instance) :slight_smile:

I implemented it as I see it - The selection is cleared whenever you lose focus to a sibling, but I guess that’s just too specific to ask…