Discussion:
disable blinking cursor and selected text in edit box
(too old to reply)
C++ Shark
2004-08-16 20:38:20 UTC
Permalink
Hi!

I'm using mfc to create a dialog with an edit box in it, to which I
write text after an event occurs. Everything works the way I want,
except that the text comes out highlighted and the cursor is blinking
irritatingly at the end of the line. I looked everywhere on the web to
find a way to disable these two but couldn't find a way. Can someone
tell me how to disable the cursor and to not have selected text
printed in the edit box?

thanks,
Craig
Priyesh
2004-08-19 14:26:20 UTC
Permalink
To disable blinking cursor, On the EN_SETFOCUS handler, try
m_Edit.HideCaret() ;
Here's the remarks from MSDN:
Although the caret is no longer visible, it can be displayed again by using
the ShowCaret member function. Hiding the caret does not destroy its current
shape.

Hiding is cumulative. If HideCaret has been called five times in a row, the
ShowCaret member function must be called five times before the caret will be
shown.
Post by C++ Shark
Hi!
I'm using mfc to create a dialog with an edit box in it, to which I
write text after an event occurs. Everything works the way I want,
except that the text comes out highlighted and the cursor is blinking
irritatingly at the end of the line. I looked everywhere on the web to
find a way to disable these two but couldn't find a way. Can someone
tell me how to disable the cursor and to not have selected text
printed in the edit box?
thanks,
Craig
g***@gmail.com
2016-02-23 12:49:22 UTC
Permalink
Post by C++ Shark
Hi!
I'm using mfc to create a dialog with an edit box in it, to which I
write text after an event occurs. Everything works the way I want,
except that the text comes out highlighted and the cursor is blinking
irritatingly at the end of the line. I looked everywhere on the web to
find a way to disable these two but couldn't find a way. Can someone
tell me how to disable the cursor and to not have selected text
printed in the edit box?
thanks,
Craig
Hi,
You are using MFC dialogue

so you may use following ::

(1.) m_ctrEdit.HideCaret();
(2.) m_ctrEdit.SetReadOnly();
Uwe Kotyczka
2016-02-25 15:19:27 UTC
Permalink
Post by C++ Shark
Hi!
I'm using mfc to create a dialog with an edit box in it, to which I
write text after an event occurs. Everything works the way I want,
except that the text comes out highlighted and the cursor is blinking
irritatingly at the end of the line. I looked everywhere on the web to
find a way to disable these two but couldn't find a way. Can someone
tell me how to disable the cursor and to not have selected text
printed in the edit box?
You also might change the tab order of your dialog, so that not
the edit ctrl gets the focus when the dialog is shown, but some
other ctrl (with the WS_TABSTOP bit set).

Just tell us a bit more about your dialog and how you want it to
behave!

Continue reading on narkive:
Loading...