I have this edit control in a dialog which I want in a read only mode.
In my program, I set the text in this control. But frustrating thing
is, the text is always highligted when the dialog shows up. Is there
any way to clear this highlighting?
Also, is there a way to keep the background white even if it is
readonly?
Thanks,
-PJ
In your OnInitDialog handler shift the focus to another control, or in a
CEdit subclass handle WM_GETDLGCODE and don't return the DLGC_HASSETSEL
flag.
>
> Also, is there a way to keep the background white even if it is
> readonly?
>
Handle its WM_CTLCOLORSTATIC.
--
Jeff Partch [VC++ MVP]
The business of setting select-all when focus is received is one of the continuous
annoyances of edit controls. I'm sure that someone, somewhere, actually likes this
feature, but I have yet to find that person.. Mostly it is just annoying.
One way is to subclass it, and in the subclass add an OnSetFocus handler, do a PostMessage
of a user-defined message which then does a SetSel to 0,0.
Using a reflected =WM_CTLCOLOR handler would solve the problem, but it is likely to annoy
the user because the white appearance will suggest the control is active. OTOH, you can
make it a less objectionable shade of gray.
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Tom
"pj" <pran...@gmail.com> wrote in message
news:1181174120.3...@a26g2000pre.googlegroups.com...
AliR.
"pj" <pran...@gmail.com> wrote in message
news:1181174120.3...@a26g2000pre.googlegroups.com...
"Tom Serface" <tom.n...@camaswood.com> wrote in message
news:OHYewtMq...@TK2MSFTNGP05.phx.gbl...
>Also, is there a way to keep the background white even if it is
>readonly?
http://bobmoore.mvps.org/Win32/w32tip45.htm
--
Bob Moore
http://bobmoore.mvps.org/
(this is a non-commercial site and does not accept advertising)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do not reply via email unless specifically requested to do so.
Unsolicited email is NOT welcome and will go unanswered.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom
"Alexander Grigoriev" <al...@earthlink.net> wrote in message
news:%23XRZeqR...@TK2MSFTNGP02.phx.gbl...