How to make the cursor move to end of a multiline edit box ?
-
Hai! I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ? Thankyou !
-
Hai! I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ? Thankyou !
kapardhi wrote:
I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ?
Do this... extern CEdit* pEdit; // Some edit pEdit.SetSel( 0, -1 ); // Move cursor to end pEdit.SetSel( -1, -1 ); // Remove selection
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
Hai! I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ? Thankyou !
Use CEdit::LineScroll m_ctlEdit.LineScroll (m_ctlEdit.GetLineCount());
-
kapardhi wrote:
I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ?
Do this... extern CEdit* pEdit; // Some edit pEdit.SetSel( 0, -1 ); // Move cursor to end pEdit.SetSel( -1, -1 ); // Remove selection
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
hello ! what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking, what i need is it must go down first and then decrease the size of scrollbar and stay at the end when data printed on the multiline edit box is completed! thanks!
-
Use CEdit::LineScroll m_ctlEdit.LineScroll (m_ctlEdit.GetLineCount());
Hello! what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking, what i need is it must go down first and then decrease the size of scrollbar and stay at the end when data printed on the multiline edit box is completed! thanks!
-
hello ! what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking, what i need is it must go down first and then decrease the size of scrollbar and stay at the end when data printed on the multiline edit box is completed! thanks!
kapardhi wrote:
what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking,
Can you try EM_REPLACESEL. Something like...
pEdit->SendMessage( EM_REPLACESEL,
TRUE,
(LPARAM)static_cast<LPCTSTR>( csTextToBeInserted ));Tell us if the blinking problem does get solved.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
modified on Wednesday, November 26, 2008 7:55 AM
-
kapardhi wrote:
what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking,
Can you try EM_REPLACESEL. Something like...
pEdit->SendMessage( EM_REPLACESEL,
TRUE,
(LPARAM)static_cast<LPCTSTR>( csTextToBeInserted ));Tell us if the blinking problem does get solved.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
modified on Wednesday, November 26, 2008 7:55 AM
-
I couldnot compile it my CEdit object is edtObj. i did the following CString str; str = "Kaps"; edtObj.SendMessage (EM_REPLACESEL, TRUE, (LPARAM) static_cast (str)); it was giving following error syntax error : '('
kapardhi wrote:
edtObj.SendMessage (EM_REPLACESEL, TRUE, (LPARAM) static_cast (str));
Sorry for that, I've modified my previous post, please check.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
kapardhi wrote:
what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking,
Can you try EM_REPLACESEL. Something like...
pEdit->SendMessage( EM_REPLACESEL,
TRUE,
(LPARAM)static_cast<LPCTSTR>( csTextToBeInserted ));Tell us if the blinking problem does get solved.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
modified on Wednesday, November 26, 2008 7:55 AM
-
Also make sure that no text is selected, else the selection will get replaced which is what this function is meant to do. So you can remove selection (use
SetSel
) first before callingReplaceSel
. Also note that there is an equivalent MFC function calledReplaceSel
.Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com