Read only TextEditor should not have caret


#1


What would you think about always hiding the caret when a textEditor is readOnly?
I find it really confusing to see a blinking caret, as it gives the feeling that we can type text in it.
the 'load file browser' FileChooser of the dialogs demo is a good example of that..
 


#2

Just call setCaretVisible (false) if you don't want one.

I'm sure there are people who'd need to make it visible, so I don't think it'd make sense to disallow this.


#3

ok, fair enough. but appart from that default behaviour, note that setCaretVisible (true) tests if the editor is read only, and make the caret visible only if it is not read only :)

 


#4

Ah, yes, that's a bit inconsistent! Ok, thanks for letting me know, I'll maybe sanity-check it when I get a moment.


#5

Often you would want to allow a user to select and copy the readonly text. So always hiding the caret is not a solution.


#6

I actually use TextEditor in read-only mode and don't want to allow the user to be able select text or display a pop-up menu. Had hidden caret as above and disabled PopupMenu with setPopupMenuEnabled (false); but can't see an easy way to disable selection. Separate issue is on Android it will auto display the keyboard which as it is read-only would prefer it didn't.


#7

Well, I think that selection should be allowed and well supported even if the carret is not shown. Like if you select this forum text in your web-browser, it will work fine, and no carret is shown.