1

Well, that's pretty similar to this question.

But

HideCaret(YourAwesomeTEdit.Handle);

seems not to be available for Firemonkey. I can't figure out how to use the same function, or even something that would achieve the same effect would be nice for the iOS app.

How do I hide the caret from a TEdit in Firemonkey?

Community
  • 1
  • 1
Machado
  • 14,105
  • 13
  • 56
  • 97
  • From a UX perspective that seems a very bad idea. – Johan Mar 24 '16 at 19:55
  • Here's how to do it in pure objective-C: http://stackoverflow.com/questions/3699727/hide-the-cursor-of-an-uitextfield/13660503#13660503 – Johan Mar 24 '16 at 19:56
  • @Johan I have a situation where the user click's "Done" at the keyboard and the caret remain blinking at the screen. From a UI perspective, it's gross not to remove it. – Machado Mar 24 '16 at 19:59
  • Then you should change the focus away from the TEdit towards the button. That should fix the issue. – Johan Mar 24 '16 at 20:00
  • I'd thought setting `.setFocus;` for another control would solve it, but it doesn't. – Machado Mar 24 '16 at 20:03
  • You need to set the focus to a control that can actually receive the focus. Don't know exactly how this works in ios. – Johan Mar 24 '16 at 20:04
  • 1
    You can change the color of the caret to the background color so you don't see it. – Doug Rudd Mar 24 '16 at 21:47
  • @Johan Obj-C not really pertinent because FMX does not use native controls – David Heffernan Mar 25 '16 at 07:03

1 Answers1

3

The TEdit has a caret property which you can set the visible property to false.

edit1.caret.visible:= false;

I don't recommend this however in your situation, as then you need to remember to re-enable it.

Also it's not clear what you mean by the 'done button' on the keyboard. Are you running on mobile? If so, then you can simply set the KillFocusByReturn property to true, and then the caret will automatically disappear and focus shifts to the form after the keyboard closes.

techraf
  • 64,883
  • 27
  • 193
  • 198
Roy Woll
  • 312
  • 1
  • 4