Click here to Skip to main content
16,005,377 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting a DLL version Pin
David Crow25-Nov-03 7:40
David Crow25-Nov-03 7:40 
GeneralRe: Getting a DLL version Pin
Tom Wright25-Nov-03 8:04
Tom Wright25-Nov-03 8:04 
GeneralRe: Getting a DLL version Pin
David Crow25-Nov-03 8:15
David Crow25-Nov-03 8:15 
GeneralTooltip lost after setting state to TBSTATE_HIDDEN Pin
ElizabethC25-Nov-03 7:22
ElizabethC25-Nov-03 7:22 
GeneralScrolling a multiline CRichEditCtrl Pin
alex2000___++25-Nov-03 7:17
alex2000___++25-Nov-03 7:17 
GeneralRe: Scrolling a multiline CRichEditCtrl Pin
igor196025-Nov-03 7:32
igor196025-Nov-03 7:32 
GeneralRe: Scrolling a multiline CRichEditCtrl Pin
alex2000___++25-Nov-03 7:43
alex2000___++25-Nov-03 7:43 
GeneralRe: Scrolling a multiline CRichEditCtrl Pin
igor196025-Nov-03 7:56
igor196025-Nov-03 7:56 
Yes, you are right, SetSel function does not scroll the contents...
However, I think that the user will be annoyed if he decides to scroll up and see for example history of messages and at that time another message arrives and your code will scroll down. I think it's not right.
So, think about it: maybe you don't have to scroll. Just append new message to the end. In that case SetSel helps.
Not insisting of course:

void CChatView::AddString(LPCSTR lpszStr, COLORREF color /* =RGB(0,0,0) */)<br />
{<br />
	LONG nStart, nEnd;<br />
	GetRichEditCtrl().GetSel( nStart, nEnd ); // remeber current selection<br />
	LONG nLength = GetTextLength( );<br />
<br />
	long lPos = GetRichEditCtrl().GetTextLength( );<br />
	GetRichEditCtrl().SetSel( lPos, lPos ); // goto the end<br />
<br />
	GetCharFormatSelection();<br />
	m_charformat.dwMask = CFM_COLOR;<br />
	m_charformat.dwEffects = NULL;<br />
	m_charformat.crTextColor = color;<br />
	GetRichEditCtrl().SetSelectionCharFormat(m_charformat);<br />
	Edit_ReplaceSel(m_hWnd, lpszStr);<br />
<br />
	if((nStart != nEnd)&&<br />
		(nLength > nEnd + 10))<br />
		GetRichEditCtrl().SetSel( nStart, nEnd ); // restore original selection // if user didn't scroll alot<br />
}


"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
GeneralRe: Scrolling a multiline CRichEditCtrl Pin
alex2000___++26-Nov-03 9:32
alex2000___++26-Nov-03 9:32 
GeneralRe: Scrolling a multiline CRichEditCtrl Pin
alex2000___++25-Nov-03 7:44
alex2000___++25-Nov-03 7:44 
GeneralRe: Scrolling a multiline CRichEditCtrl Pin
_oti14-May-09 22:34
_oti14-May-09 22:34 
GeneralMFC CListCtrl focus trouble. Pin
Alan Dugdall25-Nov-03 6:07
Alan Dugdall25-Nov-03 6:07 
GeneralRe: MFC CListCtrl focus trouble. Pin
Ravi Bhavnani25-Nov-03 6:14
professionalRavi Bhavnani25-Nov-03 6:14 
GeneralA function to maximize a Dialog Pin
d00_ape25-Nov-03 4:51
sussd00_ape25-Nov-03 4:51 
GeneralRe: A function to maximize a Dialog Pin
Ravi Bhavnani25-Nov-03 6:08
professionalRavi Bhavnani25-Nov-03 6:08 
QuestionHow to capture the mouse movement in IE? Pin
bin892225-Nov-03 4:31
bin892225-Nov-03 4:31 
AnswerRe: How to capture the mouse movement in IE? Pin
Mike Dimmick25-Nov-03 5:14
Mike Dimmick25-Nov-03 5:14 
AnswerRe: How to capture the mouse movement in IE? Pin
Roger Allen25-Nov-03 5:20
Roger Allen25-Nov-03 5:20 
GeneralMFC dialog launch from WinAPI dll Pin
El'Cachubrey25-Nov-03 2:56
El'Cachubrey25-Nov-03 2:56 
QuestionSize Limit on NEW??? Pin
Anonymous25-Nov-03 2:35
Anonymous25-Nov-03 2:35 
AnswerRe: Size Limit on NEW??? Pin
David Crow25-Nov-03 2:47
David Crow25-Nov-03 2:47 
AnswerRe: Size Limit on NEW??? Pin
jhwurmbach25-Nov-03 3:41
jhwurmbach25-Nov-03 3:41 
AnswerRe: Size Limit on NEW??? Pin
John R. Shaw25-Nov-03 8:58
John R. Shaw25-Nov-03 8:58 
GeneralFunction to pass from text to float Pin
chadell25-Nov-03 1:36
chadell25-Nov-03 1:36 
GeneralRe: Function to pass from text to float Pin
Mike Dimmick25-Nov-03 2:12
Mike Dimmick25-Nov-03 2:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.