473,699 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ 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 3812
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.n et> wrote in message
news:bh******** **@news8.svr.po l.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********@nos pam.net> wrote in message
news:%2******** *******@tk2msft ngp13.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.n et> wrote in message
news:bh******** **@news8.svr.po l.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
5397
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 attempting to do this by using an anchor point name of an anchor located
1
16687
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 (!document.getElementById) return; obj=document.getElementById("thetext"); pos -=1; if (pos < 0-obj.offsetHeight+130) return;
3
9664
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 size was changed. How can I make the scrolling content "stick" the position with respect to the scrollowing box? Your advise is appreciated. Spencer
4
19572
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 that will be part of a table stretching of to the right, which will force unwanted horizontal scrolling. How is this written in the stylesheet? Cheers Burnsy
3
4690
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 'window.pageXOffset' and 'window.pageYOffset' are not correct. Is there any other way to get the correct scrolling offsets?
2
3828
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# Windows MDI Application, as in MSDN, ie : 1) Create Windows Application (Form1), set IsMDIContainer to true 2) Create MainMenu component in the form, with top level '&File', submenu '&New' and '&Close', and another top level '&Window' with MDIList...
2
2969
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 url page
4
7793
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 find the text and select it using the function below, BUT I can't figure out how to have the textarea automatically scroll to the selection in Firefox. Any ideas or suggestions? function search(needle,haystack,start) { var element =...
3
11743
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 any idea or trick of how to achieve this? Appreciate your ideas..... Thanks Chamnap
0
8691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8620
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9038
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8920
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8887
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 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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4378
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2351
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2012
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.