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 5 3257
It sounds to me just few lines a code adding to a winform with textbox
control around. I don't think creating user control will make it work
better.
chanmm
"Dinsdale" <ru********@gma il.com> wrote in message
news:11******** **************@ f6g2000cwb.goog legroups.com... 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
"Dinsdale" <ru********@gma il.com> wrote in message
news:11******** **************@ f6g2000cwb.goog legroups.com... 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???
I would start with the Queue<T> object that will handle your FIFO
requirements. This has a ToArray method that will create a string array that
you can join using String.Join. You can then set the Text of a control like
TextBox. For the scrolling requirements I would use a flag to stop the
updating of the Text when the using is scrolling.
SP
The Queue idea is interesting (although I'm using 1.1).
Maybe it's just my implementation, but when I change the text of the
text box, the scroll bar and the text jumps around. That's why I
thought I might need to create a control.
//strMessage is the new data.
if (txtComms.Text. Length > MAX_MESSAGE_DIS PLAY)
{
intLengthToRemo ve = strMessage.Leng th + (txtComms.Text. Length -
MAX_MESSAGE_DIS PLAY);
txtComms.Text = txtComms.Text.R emove(0,intLeng thToRemove + 1);
}
txtComms.Append Text(strMessage + "\r\n");
Any idea's how to prevent this jumping? The jumping is pretty annoying
when data is coming in quickly. I would like to avoid truncating large
sections of earlier data to lessen 'jumping' as it's furstrating when
you loose the line you needed when 10,000 characters get erased.
SP wrote: "Dinsdale" <ru********@gma il.com> wrote in message news:11******** **************@ f6g2000cwb.goog legroups.com...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???
I would start with the Queue<T> object that will handle your FIFO requirements. This has a ToArray method that will create a string array that you can join using String.Join. You can then set the Text of a control like TextBox. For the scrolling requirements I would use a flag to stop the updating of the Text when the using is scrolling.
SP
"Dinsdale" <ru********@gma il.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. . The Queue idea is interesting (although I'm using 1.1).
Maybe it's just my implementation, but when I change the text of the text box, the scroll bar and the text jumps around. That's why I thought I might need to create a control.
//strMessage is the new data.
if (txtComms.Text. Length > MAX_MESSAGE_DIS PLAY) { intLengthToRemo ve = strMessage.Leng th + (txtComms.Text. Length - MAX_MESSAGE_DIS PLAY); txtComms.Text = txtComms.Text.R emove(0,intLeng thToRemove + 1); } txtComms.Append Text(strMessage + "\r\n");
Any idea's how to prevent this jumping? The jumping is pretty annoying when data is coming in quickly. I would like to avoid truncating large sections of earlier data to lessen 'jumping' as it's furstrating when you loose the line you needed when 10,000 characters get erased.
You can try using SuspendLayout and ResumeLayout. The problem is that the
scroll bar is adjusting it's size as the text changes although once it gets
to a certain number of lines the number of lines should then remain
constant.. I use a third party edit box control that seems to not be so
"jumpy" as the text is changed and it allows you to scroll back while text
is being added. As such I have never implemented the queue idea. Your
question made me think of a better implementation than what I am currently
doing which is similar to what you are currently doing. One idea is to turn
off the scroll bars in the text box and implement your own scroll bar
control.
SP SP wrote: "Dinsdale" <ru********@gma il.com> wrote in message news:11******** **************@ f6g2000cwb.goog legroups.com... >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???
I would start with the Queue<T> object that will handle your FIFO requirements. This has a ToArray method that will create a string array that you can join using String.Join. You can then set the Text of a control like TextBox. For the scrolling requirements I would use a flag to stop the updating of the Text when the using is scrolling.
SP
I'll keep you posted on my progress. This isn't a high priority item so
please be patient; I only have so much personal time to devote to my
geekiness.
:-)
Russ
SP wrote: "Dinsdale" <ru********@gma il.com> wrote in message news:11******** **************@ g10g2000cwb.goo glegroups.com.. . The Queue idea is interesting (although I'm using 1.1).
Maybe it's just my implementation, but when I change the text of the text box, the scroll bar and the text jumps around. That's why I thought I might need to create a control.
//strMessage is the new data.
if (txtComms.Text. Length > MAX_MESSAGE_DIS PLAY) { intLengthToRemo ve = strMessage.Leng th + (txtComms.Text. Length - MAX_MESSAGE_DIS PLAY); txtComms.Text = txtComms.Text.R emove(0,intLeng thToRemove + 1); } txtComms.Append Text(strMessage + "\r\n");
Any idea's how to prevent this jumping? The jumping is pretty annoying when data is coming in quickly. I would like to avoid truncating large sections of earlier data to lessen 'jumping' as it's furstrating when you loose the line you needed when 10,000 characters get erased.
You can try using SuspendLayout and ResumeLayout. The problem is that the scroll bar is adjusting it's size as the text changes although once it gets to a certain number of lines the number of lines should then remain constant.. I use a third party edit box control that seems to not be so "jumpy" as the text is changed and it allows you to scroll back while text is being added. As such I have never implemented the queue idea. Your question made me think of a better implementation than what I am currently doing which is similar to what you are currently doing. One idea is to turn off the scroll bars in the text box and implement your own scroll bar control.
SP
SP wrote: "Dinsdale" <ru********@gma il.com> wrote in message news:11******** **************@ f6g2000cwb.goog legroups.com... >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???
I would start with the Queue<T> object that will handle your FIFO requirements. This has a ToArray method that will create a string array that you can join using String.Join. You can then set the Text of a control like TextBox. For the scrolling requirements I would use a flag to stop the updating of the Text when the using is scrolling.
SP
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tobias Pfeiffer |
last post by:
Hi!
I want to write a "client-server-application" (only running on the same
machine) or actually I've already begun with and have problems with the
interprocess communication. The server, when started, opens a FIFO and
opens it with open(infifo, 'r'). Then I check the content of the file
with
while 1:
line = serverIn.readline()
|
by: Luca |
last post by:
I have the need of a container of integers showing both the
characteristics of an associative container (all integer elements
different from each other) and the FIFO behaviour.
Do you know if there is a ready-made container for that or if I have
to use - for example - a set<int> and produce by myself FIFO
behaviour, or maybe I can use a...
|
by: Michele Moccia |
last post by:
How can I implement a "time critical" fifo in c++ ?
I just have to manage sequences of raw bytes, no user defined types.
An std::queue<unsigned char> or std::deque<unsigned char> seems to be slow.
I've compared that to a platform depended solution (i tried to use a MS
Window pipe in the same process to create a fifo and it's very faster).
...
|
by: Jack |
last post by:
I want to implement a fixed-size FIFO queue for characters.
I only want to use array not linked list.
For example,
const int N = 10;
char c_array;
The question is when the queue is full, there are ten characters in the
|
by: mai |
last post by:
Hi everyone,
i'm trying to exhibit FIFO anomaly(page replacement algorithm),, I
searched over 2000 random strings but i couldnt find any anomaly,, am
i I doing it right?,, Please help,,,The following is the code,,
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <ctime // For time()
| |
by: Polatrite |
last post by:
I'm working on a project currently that needs to have a fast FIFO text box that displays output from a serial device. It also needs to have fast refresh rate as the data can stream in at about 50 samples a second.
I'm a new C#/managed/.NET developer, so pardon me if I don't understand some principals. A friend recommended I look into a queue,...
|
by: Spoon |
last post by:
Hello,
I'm wondering whether the STL defines a data structure with
the following features:
o provides push_front() and pop_back() (like std::list) to
implement a FIFO buffer.
o allows fast lookup (like std::map) so I can easily search
for a specific item in the buffer.
|
by: doxtor |
last post by:
Hi all..I'm a little bit confuse with this problem.
I have 3 tables, stock_in, stock_level, and stock_out.
stock_in used for save the data product when there's new purchase.
stock_out used for save the data product out.
stock_level used for count how many stock in warehouse.
stock_in : in_id, product_id, stock_in_unit, stock_in_price,...
|
by: sazd1 |
last post by:
Hi Student2
I am working on similar kind of thing for stock calculation but could not find any solution to my problem even after putting my problem to different forums.
I saw your post that you have solved this problem of stock calculation.
i need help for that too.
I am using vb express and MsAccess as database.
I am trying to write a query...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |