Sign in to follow this  
lonewolff

Auto scrolling to bottom of edit box?

Recommended Posts

lonewolff    1182

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 :)

Share this post


Link to post
Share on other sites
lonewolff    1182

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this