473,471 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

A Nice Scrolling Window

Hi can anyone point me to some sample source code for a scrolling window.

What I want is a text window that monitors incoming data continuously, so it
has to hold say a couple of hundred lines then after that the early lines
need to erase as new data arrives.

The only way I have seen this done is by copying to a buffer, deleting the
first bit then putting it back in a text window.

It does work, but it causes the scroll bar to quickly jump, you don't often
see it, but it just doesn't seem very elegant, there must be a better way.

Ken
Nov 15 '05 #1
2 3805
Ken,

Two fairly easy things I can think of with say a RichTextEdit window.
The lines property is basically an array of strings. Every time a line is
added to the window, you should make the newest line visible, that will
keep your smaller window view into the 200 lines always at the last entry.
Secondly, every time a couple of lines ares added and you are over 200,
delete just the first few. This should ensure that your scrollbar doesn't
jump arround too much. I have not tried this, and its possible that the
extra redraws you may see would also not be desirable.

Instead you could have a string [200] and once full you delete the first
to add a new at the end ie; remove mystrarr[0], add mystrarr[199]. Then in 1
shot you could set the editbox text to the contents of your string array-
thus only encurring one redraw.

Just some thoughts.
Erin.
"Ken Williams" <g3***@gb7abc.net> wrote in message
news:bh**********@news8.svr.pol.co.uk...
Hi can anyone point me to some sample source code for a scrolling window.

What I want is a text window that monitors incoming data continuously, so it has to hold say a couple of hundred lines then after that the early lines
need to erase as new data arrives.

The only way I have seen this done is by copying to a buffer, deleting the
first bit then putting it back in a text window.

It does work, but it causes the scroll bar to quickly jump, you don't often see it, but it just doesn't seem very elegant, there must be a better way.

Ken

Nov 15 '05 #2
Yes but it does make the scroll bar jump, when you delete the first line
and do a re draw the scroll bar starts at line one and follows the cursor.

It's a very fast jump, but it makes me think I must be using the wrong
approach.

Ken

"EMonaco" <er********@nospam.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Ken,

Two fairly easy things I can think of with say a RichTextEdit window.
The lines property is basically an array of strings. Every time a line is
added to the window, you should make the newest line visible, that will
keep your smaller window view into the 200 lines always at the last entry.
Secondly, every time a couple of lines ares added and you are over 200,
delete just the first few. This should ensure that your scrollbar doesn't
jump arround too much. I have not tried this, and its possible that the
extra redraws you may see would also not be desirable.

Instead you could have a string [200] and once full you delete the first
to add a new at the end ie; remove mystrarr[0], add mystrarr[199]. Then in 1 shot you could set the editbox text to the contents of your string array-
thus only encurring one redraw.

Just some thoughts.
Erin.
"Ken Williams" <g3***@gb7abc.net> wrote in message
news:bh**********@news8.svr.pol.co.uk...
Hi can anyone point me to some sample source code for a scrolling window.
What I want is a text window that monitors incoming data continuously, so
it
has to hold say a couple of hundred lines then after that the early

lines need to erase as new data arrives.

The only way I have seen this done is by copying to a buffer, deleting the first bit then putting it back in a text window.

It does work, but it causes the scroll bar to quickly jump, you don't

often
see it, but it just doesn't seem very elegant, there must be a better way.
Ken


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: yootzee | last post by:
Greetings all, I'm having a problem with scrolling vertically in a newly created browser window. The vertical scrolling is to reach some anchor point within the new browser window. I'm...
1
by: Midas NDT Sales | last post by:
I have been looking at a simple example of a scrolling text box (the one in the SAM book) as below: <script language="JavaScript"> var pos=100; function Scroll() { if...
3
by: spencer | last post by:
Hello, I have an index page with an autoscroller writen with CSS. The problem is the scrolling content(text and inages)'s position is correct but will off position when the broswer(IE) window...
4
by: mr_burns | last post by:
Hi, Is it possible to disble horizontal scrolling using CSS? I want to try and use two backgrounds, one tiling vertically and part of the body background, which will not force scrolling, but one...
3
by: Vikram Bhatia | last post by:
1. Is there an event to capture scrolling using mouse wheel in Netscape 6.x? 2. When arrow keys are used to scroll a page in Netscape 6.x, the scrolling offsets obtained using...
2
by: James CC | last post by:
I have a strange bug in C# using windows forms. To make sure it's not some bug with my code, I've gone back to a simple test app, and still see the same behavior. I have created a simple C#...
2
by: P2P | last post by:
Hi I am wondering if someone know of a free cross-browsers vertical scrolling script that - is cross cross-browsers - will call the scrolling content from an external html page or from a...
4
by: Keith Bentrup | last post by:
Hi all, I wrote a simple search function to find text in a textarea where not all the text is visible (ie. the text box displays 10 lines but there may be more than 1000 lines to search). I can...
3
by: Chamnap | last post by:
Hello everybody, I have one problem. I want to do something after the user finished scrolling. The scroll event fires whenever the user is scrolling. I don't want this actually. Does anyone has...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
1
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...
0
tracyyun
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...
0
agi2029
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.