Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Auto scrolling to bottom of edit box?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


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

#1 DarkRonin   Members   

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


Win32 Developer
One Of Them - Martial arts game that is mid development.

#2 Paradigm Shifter   Members   

5832
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   

1173
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.

Win32 Developer
One Of Them - Martial arts game that is mid development.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.