Jump to content

  • Log In with Google      Sign In   
  • Create Account


Auto scrolling to bottom of edit box?

  • You cannot reply to this topic
2 replies to this topic

#1 DarkRonin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 18 July 2014 - 12:09 AM

Hi Guys,

 

I have a multiline edit box (non-MFC) in pure c++ and can display text happily in it.

 

But how do I make the edit box scroll automatically to the bottom of the text (once the edit box has filled up). At the moment I have to scroll manually.

 

This is my edit boxcreation code

 

hEdit=CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_AUTOVSCROLL|WS_VSCROLL,0,0,nNewWidth-16,nNewHeight-36,hWnd,(HMENU)IDC_MAIN_EDIT,GetModuleHandle(NULL),NULL);
 
strcpy(buffer,"Some text \r\n");
SendMessage(hEdit,WM_SETTEXT,NULL,(LPARAM)buffer);

 

Any advice would be awesome :)



Sponsor:

#2 Paradigm Shifter   Crossbones+   -  Reputation: 5248

Like
1Likes
Like

Posted 18 July 2014 - 01:18 AM

This should do what you want

 

http://support.microsoft.com/kb/12190

 

EDIT: But since it isn't on a dialog you don't need to call GetDlgItem, just use the edit hWnd directly.


Edited by Paradigm Shifter, 18 July 2014 - 01:20 AM.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

#3 DarkRonin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 18 July 2014 - 01:41 AM

This should do what you want

 

http://support.microsoft.com/kb/12190

 

EDIT: But since it isn't on a dialog you don't need to call GetDlgItem, just use the edit hWnd directly.

 

 

Thanks for your reply. Just tried this. But, this seems to only select the text and doesn't actually scroll to the bottom of the editbox unfortunately.

 

[edit]

Although you did put me on the right track :)

 

SendMessage( hEdit, EM_LINESCROLL , 0, 65535 );


Edited by DarkRonin, 18 July 2014 - 01:46 AM.






PARTNERS