473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Mysterious vScrollbar.Value update timing, can anyone shed light?

Hi all,
I AM HAVING PROBLEMS UNDERSTANDING THE UPDATING BEHAVIOR/TIMING OF A
WINDOWS.FORMS.SCROLLBAR COMPONENT...[to avoid confusion, "REAL" scrollbars,
not subcomponents of an autoscrolling container]

quick apology for my sorry posterior if posting in wrong place -- haven't
much experience with these groups, and can find nothing more specific than
csharp.

my program manually sets up some synchronization between the user's mouse
[home-made mouse dragging code], some bitmaps viewable on container's surface
(panel, it happens), and two scrollbars that move in concert

Since scrollBars practically "live" just to constantly shift through X,Y
planar data, i'm attempting to read data from the bars.Value property in my
MouseMove handler -- when the scrollbar values reach the ends of their
ranges, its an accurate, simple (but indirect) indicator that's useful for
controlling my app simulation's behavior..

There is no problem reading the various scrollbar property data values, BUT,
these do not appear time synchronized with the mouse movements [or with
realtime, the mouse seems to report coordinates 'now' or thereabouts,
scrollbars at their convenience, typically, 'later') (data is always
correct, eventually, but i get the mouse data significantly before the .value
of the scrollbar catches up. [I am basing my assertion that the scrolls
update inefficiently partly on the observation that WHEN I MOVE THE MOUSE
VERY SLOWLY, the scrollbar.value and mouse coords recieved in mouseMove
behave as i expect, (map/demonstrate time and data synchronization). But if
i go too fast, the .value property lags, and i get my mousemove message with
"go go, zoom zoom" info before the "no, no, edge of cliff just ahead info],
and my images careen off the edge of the panel! But its quite possible that
i don't even have this much right, -- interestingly, this hack "solves" the
problem, [very, very bad code, do not emulate, not useable, hardware
dependent]:

private void viewWindow_MouseMove( object sender, MouseEventArgs e )
{
if ( !bVWDragging )
return;
int changeY = e.Y - oldVWMouse.Y;

// INTENTIONALLY 'HOBBLE' MOUSE to speed limit = 16 pixels per
report

if ( Math.Abs( changeY ) > 16 )
if ( changeY > 0 ) changeY = 16; else changeY = -16;

if ( vScrollBar1.Visible == true )
{
if ( changeY > 0 && vScrollBar1.Value > vScrollBar1.Minimum )
{

// hobble mouse even MORE SEVERELY if getting near Minimum
// (the point we are tracking and desire timely info about)
if ( vScrollBar1.Value < 16 )
{
changeY = 1;

[Ultimately I probably "should" obtain the position data i need directly
from the elements i am trying to control, rather than indirectly as above,
but there can be many of them, arranged arbitrarily, and the scrolls are very
appetizing because all the DO is contain the information i want! But i seem
to recall scrapping over sharp shoals any time in the past i've tried to do
anything aside from passively responding to scrollbar event handlers and
repositioning stuff accordingly --scrolls seem to be unreliable instrument
for obtaining this kind of indirect reading. Anyway, would much appreciate
any info related here, problem is nasty and would like to learn my lesson
once and fall all on this. One, probably wrong quess is that there may be an
unprocessed queue of messages from the scrollBars in the panel's message
queue, but my computer is shiny new and therefore quite fast machine, and
it's hard to believe that it can't keep up with the movements of the mouse,
-- my wrist action is pretty powerful, but i'm not hearing sonic booms or
observing relativistic contractions of spacetime down there in the vicinity
of my mousepad!
Mar 22 '06 #1
0 1286

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

Similar topics

2
by: Jordan Peterson | last post by:
When rendered in IE 6, the group of 4 light-blue links http://maba.org/new/homeproducts/ has a gap between SEMINARS and SHOW ACTIVITIES. Gecko does not render it this way. Can anyone shed some...
2
by: M Wells | last post by:
Hi All, I'm trying to track down a mysterious problem we're experiencing in which updates and inserts to tables in our mssql2k server appear to be 'disappearing.' To explain our situation: ...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
1
by: Dmitri Shvetsov | last post by:
Hi All, Did somebody play with vScrollBar in C#? I've got a small trouble. When I assign the Maximum value and try to move the slider of the vScrollBar to a maximum position I can't get the...
0
by: bleedledeep | last post by:
I have a DataGrid that ends up with a VScrollBar due to the number of rows, and the behavior I want is for the bottom-most row of the DataGrid to be shown, i.e., I want the VScrollBar all the way...
3
by: Alfonzo Morra | last post by:
Hi, I recently started using VC7.1 (upgraded from VC6). I've noticed that when stepping through code, some of the values of my variables make no sese at all. For instance, I had some code like...
0
by: Paul W | last post by:
Hi - I have an app that does not use sessions: <sessionState mode="Off" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"...
10
by: SHPsalm139 | last post by:
We have an Access 2K application that uses multiple forms. We currently hardcode the release number in a label on each form but this gets tedious to do each time there's a new release. I thought...
1
by: eBob.com | last post by:
I have two apps, both developed using the same VBE, and both having a VScrollBar, but the two VScrollBars have very different styles. (In the screen shot, which I had hoped to attach but can't,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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,...

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.