| | |
Send text to multiline EditBox
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 24
Reputation:
Solved Threads: 0
Hi Guys,
I'm trying to write a program (MFC) that while working displays a log to the user. For this log I thought I'd use an Edit Box because I can set it to be "multiline".
What I had in mind is to display each new log entry in a new row. Now I don't know any other function that I can use in order to display my text except "SetWindowText".
I tried using it with "LineScroll()" to write to a new line but it doesn't work. It only overwrites the first row.
So clearly I'm using the wrong function and maybe even the wrong Object to display my log.
Please Help....
Thank you,
Gadi
I'm trying to write a program (MFC) that while working displays a log to the user. For this log I thought I'd use an Edit Box because I can set it to be "multiline".
What I had in mind is to display each new log entry in a new row. Now I don't know any other function that I can use in order to display my text except "SetWindowText".
I tried using it with "LineScroll()" to write to a new line but it doesn't work. It only overwrites the first row.
So clearly I'm using the wrong function and maybe even the wrong Object to display my log.
Please Help....
Thank you,
Gadi
•
•
Join Date: Mar 2008
Posts: 1,489
Reputation:
Solved Threads: 123
The problem is easy to solve, instead of adding a new line to the text box, simply add the line to a global string, then assign the string to the textbox. You could also consider using a Listbox instead.
Hope this helps.
C++ Syntax (Toggle Plain Text)
#include <windows.h> #include <iostream> HWND hEdit; // Text Box std::string log; void AddLogLine(char *line) { log += line; log += "\n"; SetWindowText( hEdit, log.c_str() ); } /* Rest of the Code *
Hope this helps.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Structures in Classes
- Next Thread: end char = '/0' ???
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






