Search code examples
delphi-7

How do I write blue text for Delphi that deletes as soon as you start typing


I need to write blue text on an edit so that it deletes as soon as I start typing on it when it run. Please can you help me with how that works. This is for Delphi 2007

Thanks in advance


Solution

  • Out of my head, not tested:

    • Use a standard TEdit.
    • Set a boolean variable (flag) to TRUE.
    • Write blue text in TEdit.
    • Set edit cursor on first position
    • In the OnKeyDown, if the flag is true then set the flag as false and delete the text in edit