Update of /cvsroot/anyedit/AnyEditv2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2490
Modified Files:
OutputEdit.cpp
Log Message:
Fixed adding lines to OutputEdit. It now scrolls without jumping to the start of the EditBox.
Index: OutputEdit.cpp
===================================================================
RCS file: /cvsroot/anyedit/AnyEditv2/OutputEdit.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** OutputEdit.cpp 12 Oct 2005 18:55:57 -0000 1.9
--- OutputEdit.cpp 17 Oct 2005 17:18:59 -0000 1.10
***************
*** 67,75 ****
{
CString szCurrentText;
GetWindowText(szCurrentText);
! if( !szCurrentText.IsEmpty() ) szCurrentText += "\r\n";
! szCurrentText += lpszNewStr;
! SetWindowText(szCurrentText);
! SetSel(szCurrentText.GetLength()+1,szCurrentText.GetLength()+1);
}
--- 67,90 ----
{
CString szCurrentText;
+
+ // Construct the new line with EOL
+ szCurrentText = lpszNewStr;
+ szCurrentText += "\r\n";
+
+ // This trick prevents the jump to the first
+ // line in when Setting the Window Text. We
+ // paste the text from the Clipboard at the
+ // end of the Edit box.
+ CopyStrToClipboard(szCurrentText);
+ Paste();
+ // TODO: Is there a way to save the clipboard content?
+ EmptyClipboard();
+
+ // Set the new text of the Edit box.
GetWindowText(szCurrentText);
!
! // Scroll the Editbox, so the last line is visible.
! int length = szCurrentText.GetLength();
! SetSel(length,length);
}
|