D
Dinsdale
I have an application that recieves text data via external input (i.e.
serial) and displays it on the screen (we use carraige return as a
delimiter). At this point I use a regular old text box and when the
text size gets too big I truncate the string and re-set the
TextBox.Text property. This solution is very crappy as it creates a
flickering scroll bar when I re-set the text. Scrolling is also
difficult because the position in the text jumps to the end when I
append something new.
So, I have decided that I need to write a user control that will allow
me to do the following:
- Display text as it is received by the application
- Set the max number of characters (or lines) that can be displayed
- Create a FIFO style of adding text, so once the max number of
characters are reached, the display text is truncated from the
beginning and added at the end, without having the scroll bar jump
around
- Have a way of controlling the position displayed so I can scroll up
and view older text while new text is being added (i.e. you can hold
the scroll bar and the text stays put until you let go. I saw this in
Tera Term. Neat feature.)
- Nice to have: Select a truncate character (i.e. Carriage Return) so
that instead of loosing x number of characters, the text is truncated
by "line".
I'm totally stumped as I've never had to try this sort of thing before.
I'm considering a Panel of Labels that displays each "line" separately
and then adds/removes the controls to create the FIFO effect. I could
use a scroll bar to scroll up and down in the panel...maybe? The
problem is when I want to start re-sizing forms, the text won't really
format correctly unless I start doing some pretty wierd calculations
and grow the height of the label when the width shrinks.
So, any ideas where to start with this???
Cheers,
Russ
serial) and displays it on the screen (we use carraige return as a
delimiter). At this point I use a regular old text box and when the
text size gets too big I truncate the string and re-set the
TextBox.Text property. This solution is very crappy as it creates a
flickering scroll bar when I re-set the text. Scrolling is also
difficult because the position in the text jumps to the end when I
append something new.
So, I have decided that I need to write a user control that will allow
me to do the following:
- Display text as it is received by the application
- Set the max number of characters (or lines) that can be displayed
- Create a FIFO style of adding text, so once the max number of
characters are reached, the display text is truncated from the
beginning and added at the end, without having the scroll bar jump
around
- Have a way of controlling the position displayed so I can scroll up
and view older text while new text is being added (i.e. you can hold
the scroll bar and the text stays put until you let go. I saw this in
Tera Term. Neat feature.)
- Nice to have: Select a truncate character (i.e. Carriage Return) so
that instead of loosing x number of characters, the text is truncated
by "line".
I'm totally stumped as I've never had to try this sort of thing before.
I'm considering a Panel of Labels that displays each "line" separately
and then adds/removes the controls to create the FIFO effect. I could
use a scroll bar to scroll up and down in the panel...maybe? The
problem is when I want to start re-sizing forms, the text won't really
format correctly unless I start doing some pretty wierd calculations
and grow the height of the label when the width shrinks.
So, any ideas where to start with this???
Cheers,
Russ