How do I have a CEdit control display placeholder text when it's empty, similar to the behavior of NSTextFields in Cocoa?
A:
you could create a small window over the top of it that contains the placeholder text. Then when the user sets the keyboard focus to it hide the window and if the focus is removed and nothing is in the box then show it.
Goz
2009-08-20 15:06:11
+1
A:
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
- or -
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
Fat Elvis
2009-08-20 16:32:04
SetCueBanner() is what I was looking for, thanks.
drewh
2009-08-20 20:03:50