Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Syntax Edit
  New Posts New Posts RSS Feed - HOWTO: Append one line of text
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOWTO: Append one line of text

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: HOWTO: Append one line of text
    Posted: 01 March 2013 at 5:10am
Hi;

I want to use the control as a logger output window for online tcp communication. So I'm looking for the fastes possible way to append a new line of text at the end of the control content buffer and ensure that this line is visible and selected.
Can anyone show me how to solve this.

Regards, 
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 22 August 2013 at 7:13am
No ideas?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
DazMan View Drop Down
Newbie
Newbie
Avatar

Joined: 30 March 2009
Location: UK
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote DazMan Quote  Post ReplyReply Direct Link To This Post Posted: 28 March 2015 at 5:33pm
Hi Martin,

Not sure if it is the fastest, but works

// Get the last row in the Edit Control, add 1 for newly appended line
int iLastRowNo = m_pEditCtrl->GetRowCount() + 1;
// Add some test text to new Row
m_pEditCtrl->InsertRow(iLastRowNo, _T("This is a new row"), TRUE);
// Move to the newly inserted Row
m_pEditCtrl->GoToRow(iLastRowNo, FALSE);
// Position Caret to end of line, forcing it visible at same time
m_pEditCtrl->SetCurPos(iLastRowNo, m_pEditCtrl->GetLineText(iLastRowNo).GetLength() + 1);

Cheers,
Daz
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.