Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show placeholder in TEdit

Is there any way to add a placeholder text to an edit?

My only idea is to always manually set the color and the text of the given edit in its OnChange event, but it seems to be a bit tedious to me.

Any other suggestions?

like image 730
Oh nooo Avatar asked Apr 15 '16 09:04

Oh nooo


2 Answers

What you are looking for is handled by the TEdit.TextHint property. Note that it only works on XP and later with Visual Themes/Styles enabled for the app.

like image 194
Remy Lebeau Avatar answered Nov 01 '22 14:11

Remy Lebeau


In case anyone got here like me through a web search, in cross-platform versions of Delphi using FMX, the placeholder display is handled by TEdit.TextPrompt.

like image 26
bLight Avatar answered Nov 01 '22 14:11

bLight