Is a TextBox for Console logging a good idea?

Hi I am currently trying to figure out the best way to log what my program is doing. However I dont want to use the plain console window since its not pleasant to work with (one can only resize it vertically, the font is horrible, its impossible to select and copy something, etc).

So I would like to show something like a "console log window" where everything is nicely documented and I can scroll through the logged text if I want.

I thought of using a TextBox control for that but is this a good idea? I mean its probably better suited for input, not output or?
Textbox is ok. Just check the maximum capacity for text, if any, in case you log too much information.
Thx. Do you know what the maximum text capacity of console window (cmd.exe) is?

So I have a reference what a good value is. I already tried searching in Microsoft's Support page but only found the maximum text length of a command.
If you want to log from the console you have to hide the password.
So textbox is good for form application.
The console buffer size is configurable per application or per application shortcut. Use the Properties window for the app or the shortcut to see it or set it.

I don't know the textbox's capacity, but I'm sure it is much larger.
The property sheet for the console allows a maximum of 9999 lines for the buffer, if that helps.

If your logging out line by line, you might want to consider using a listbox, like this guy.

A Logging Listbox Control
http://www.codeproject.com/KB/combobox/logcontrol.aspx

But with a more up to date version of VC++

Andy

However I dont want to use the plain console window since its not pleasant to work with (one can only resize it vertically, the font is horrible, its impossible to select and copy something, etc).


Don't know what you are talking about. Its fully configurable. Right or left click up in the title bar and a system menu comes up where you can select any text, copy it, etc. Further, under Properties you can configure any width or height you want (within reason).

In my mind a text box is the worst possible idea for logging program activity. Every time you write to it whatever was in it is replaced with new material. A listbox wouldn't suffer from that. However, the best way to log program actiivity is through an output log file. Its how I've been working like forever.

Don't know what you are talking about. Its fully configurable

Wow I never noticed that cmd had that feature, thx for that tip ;)

Still I believe its not a good solution (at least I would like to have another).

I actually already stumbled upon the listbox a short time after I wrote my last post and it seemed nice to me so I already implemented it.
It works well but is it also possible to use multiple lines for one entry that is added to the listbox? In case the string is too long for the listbox. I know you can add horizontal bars to it but I still would like to know if it is possible to say that one entry uses more than one line.

Also are the elements in the listbox automatically deleted once the listbox is full? so it would delete one after another when the limit is reached but there are still entries added.
And what about the string limit for one entry? I didnt found anything about that in the descriptions for the listbox.

I know I ask alot about the limits but I just want to be sure that there will be no problems with using the selected output method for my program ;)


However, the best way to log program actiivity is through an output log file. Its how I've been working like forever.

Actually I am already doing that, I just want to give the user the possibility to quickly take a look at what is happening right now and what happened a short time before that (preferably in colours (red for warnings etc)) which I cant do when I only save all the logs in files (that is better suited for long time logging imo).
Last edited on
I'm not sure Zapeth. I've never used a listbox for that purpose. If I recall, its a list box specific SendMessage call that adds a line to a listbox, and I don't believe it breaks long lines. Perhaps someone else can jump in who knows for sure. You can always experiment yourself.
Topic archived. No new replies allowed.