mfc

MFC CEdit placeholder text


How do I have a CEdit control display placeholder text when it's empty, similar to the behavior of NSTextFields in Cocoa?


Solution

  • Ages ago, I wrote a custom paint routine to do it, seemed to work fine.

    Sometime after, they introduced SetCueBanner to CEdit, but I can remember it:

    a) not working correctly

    b) not behaving the way I wanted

    Perhaps it will work fine for you. If not, I can see if I can find my old code and post what I did in the custom paint routine.

    EDIT

    I just checked the Win32 docs, I think this is why I abandoned it:

    You cannot set a cue banner on a multiline edit control