Click here to Skip to main content
15,902,189 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Linking Error using GLUI ('MSVCRT' conflicts with use of other libs) Pin
LostPitch7-Dec-08 14:11
LostPitch7-Dec-08 14:11 
QuestionRe: Linking Error using GLUI ('MSVCRT' conflicts with use of other libs) Pin
Randor 7-Dec-08 17:48
professional Randor 7-Dec-08 17:48 
AnswerRe: Linking Error using GLUI ('MSVCRT' conflicts with use of other libs) Pin
LostPitch8-Dec-08 2:18
LostPitch8-Dec-08 2:18 
GeneralRe: Linking Error using GLUI ('MSVCRT' conflicts with use of other libs) Pin
LostPitch8-Feb-09 5:34
LostPitch8-Feb-09 5:34 
QuestionBlock windows key Pin
dj44007-Dec-08 1:30
dj44007-Dec-08 1:30 
AnswerRe: Block windows key Pin
Code-o-mat7-Dec-08 1:43
Code-o-mat7-Dec-08 1:43 
QuestionScroll Bar Position Control Pin
Shivbalaji6-Dec-08 23:30
Shivbalaji6-Dec-08 23:30 
AnswerRe: Scroll Bar Position Control Pin
Graham Shanks7-Dec-08 11:21
Graham Shanks7-Dec-08 11:21 
I assume that you are sending text programatically to the rich edit text box. You need to scroll down using LineScroll. Since LineScroll will not let you scroll past the last line of text you could use MyEdit.LineScroll(MyEdit.GetLineCount(), 0). That puts the last line of text at the top of the edit control. This probably isn't what you want - I assume that you would want the last line of text at the bottom of the display. To do this you need to the following every time the contents of the edit control is modified:

a) Get the number of visible lines in the edit control
b) Get the number of the first visible line using the GetFirstVisibleLine() method
c) Get the total number of lines in the edit control using the GetLineCount() method
d) If the number of visible lines plus the first visible line is less than the total number of lines then scroll by the difference using the LineScroll() method

The following code will do it

void MakeLastLineVisible(CRichEditCtrl& edit)
{
  int LastVisibleLine = edit.GetFirstVisibleLine() - NumberVisibleLines(edit);
  if(LastVisibleLine < edit.GetLineCount())
  {
    edit.LineScroll(edit.GetLineCount() - LastVisibleLine);
  }
}


The only problem is how to implement the NumberVisibleLines function. This Microsoft article[^] shows how to do it properly. If the size of the edit control and the font used is fixed then you could just use a constant value (determined by experiment)

Graham

Librarians rule, Ook!

GeneralRe: Scroll Bar Position Control Pin
Member 46517417-Dec-08 21:54
Member 46517417-Dec-08 21:54 
QuestionFind position of first occurrence of a case-insensitive string int stripos ( char* haystack, char* needle, int offset ) Pin
wizardzaw6-Dec-08 22:16
wizardzaw6-Dec-08 22:16 
AnswerRe: Find position of first occurrence of a case-insensitive string int stripos ( char* haystack, char* needle, int offset ) Pin
Jijo.Raj6-Dec-08 23:22
Jijo.Raj6-Dec-08 23:22 
GeneralRe: Find position of first occurrence of a case-insensitive string int stripos ( char* haystack, char* needle, int offset ) Pin
wizardzaw7-Dec-08 3:01
wizardzaw7-Dec-08 3:01 
QuestionThreads in MFC Pin
sushrut836-Dec-08 22:01
sushrut836-Dec-08 22:01 
AnswerRe: Threads in MFC Pin
Jijo.Raj6-Dec-08 23:01
Jijo.Raj6-Dec-08 23:01 
AnswerRe: Threads in MFC Pin
Hamid_RT7-Dec-08 5:20
Hamid_RT7-Dec-08 5:20 
AnswerRe: Threads in MFC Pin
David Crow8-Dec-08 4:11
David Crow8-Dec-08 4:11 
QuestionThe ordinal 345 is not located in comctrl32.dll Pin
nutkase6-Dec-08 13:57
nutkase6-Dec-08 13:57 
AnswerRe: The ordinal 345 is not located in comctrl32.dll Pin
Randor 6-Dec-08 14:29
professional Randor 6-Dec-08 14:29 
QuestionQuestion regarding FsContext Pin
Green Fuze6-Dec-08 11:54
Green Fuze6-Dec-08 11:54 
AnswerRe: Question regarding FsContext Pin
Randor 6-Dec-08 14:57
professional Randor 6-Dec-08 14:57 
GeneralRe: Question regarding FsContext Pin
Green Fuze6-Dec-08 14:59
Green Fuze6-Dec-08 14:59 
GeneralRe: Question regarding FsContext Pin
Randor 6-Dec-08 15:42
professional Randor 6-Dec-08 15:42 
GeneralRe: Question regarding FsContext Pin
Green Fuze6-Dec-08 15:52
Green Fuze6-Dec-08 15:52 
GeneralRe: Question regarding FsContext Pin
Randor 6-Dec-08 16:24
professional Randor 6-Dec-08 16:24 
GeneralRe: Question regarding FsContext Pin
Green Fuze6-Dec-08 16:33
Green Fuze6-Dec-08 16:33 

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.