The VCL memo control is a loose wrapper around the Win32 multiline edit. The password character functionality of the edit control is only available for single line edits.
The behaviour is controlled by the ES_PASSWORD
style for which the documentation says:
Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls.
The FMX memo control offers no password character functionality for the multiline memo control.
Presumably these frameworks don't offer what you want because passwords are entered in single line edit controls. Developers tend not to provide functionality that has no clear case for being used.
Your options:
- Use a single line
TEdit
.
- Write your own multiline memo that supports your desired functionality.
- Find a third party multiline memo that supports your desired functionality.
Now, since your question is so general I have assumed that you want full support for single line password character. That is, the user enters text and it appears masked.
But maybe you actually don't need editability. In that case it is simple enough. Do the following:
- Load or add the true text into a separate
TStringList
.
- When you want to display the true text assign the string list to the memo.
- When you want to hide the content, process the true text into whatever you want to display, and display that.
- Make the memo control read only.