Subject Re: [IBO] TIB_Grid ThumbTrack Q
Author Jason Wharton
Correct that the behavior will remain the way it is.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com

-- We may not have it all together --
-- But together we have it all --


----- Original Message -----
From: "Brian K. Woods" <brian@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, December 20, 2002 11:55 AM
Subject: RE: [IBO] TIB_Grid ThumbTrack Q


> Alan,
> Your problem intrigued me, so I tested it myself. I found the same
> behavior, and started looking for the cause. I found it, however, I'm not
> sure it's something that can ( or even should be ) fixed. I'll let you
and
> Jason decide that. I'm only starting to get familiar with the innards of
> IBO, so someone who knows the code in and out should look at it. I'll
just
> sum up what I figured out...
>
> The problem lies in the min/max range of the scroll bar. Until the
> recordcount is known, the UpdateScrollbar method of the grid falls into
the
> else clause (see below:
>
> if CursorRecordCountValid then
> begin
> [SNIP]
> end
> else
> begin
> file://THE CODE FALLS IN HERE UNTIL THE RECORDCOUNT IS KNOWN
>
> if not BufferHasBof then Dec( SINew.nMin, SINew.nPage div 2 +
1 );
> if not BufferHasEof then Inc( SINew.nMax, SINew.nPage div 2 +
1 );
> end;
>
> These "guess-timated" values of SINew.nMin and nMax are then used at the
> bottom of the
> function to set the scrollbar's parameters with
> SetScrollInfo( Handle, SB_VERT, SINew, True );
>
> To verify that this is the cause, I pumped a dummy table with 500000
single
> field rows (an integer, with vals from 0 to 499999), then pointed an
IB_grid
> at it with thumbtracking enabled. Then I performed your procedure of
> dragging the
> thumb around. If you pay attention to the integer values (the whole
reason
> I used an integer field), every
> time you drag the thumb to the bottom and let go, the grid brings in a new
> set of rows roughly equal to half the
> number of visible grid rows. If you force the query to fetch all 500000
> rows, ( i used a separate button's click event ),
> then, voila! Drag the thumb up and down, let go anywhere, and it behaves
> just like it should from then on. Therefore,
> the problem lies in that the query doesn't know how many actual data rows
> there are until you pull them all, so the scrollbar's min and max vals
> aren't being set correctly, which means that windows can't pass the
correct
> thumbposition to the
> grid in the WMVSCROLL message handler...
>
> I hope this helps you guys figure out a viable solution, since I agree
that
> to a customer, this could be confusing... What you could do in the
interim
> is just force a fetchall up front when using thumbtracking.
>
> Brian
>
> > -----Original Message-----
> > From: Jason Wharton [mailto:jwharton@...]
> > Sent: Thursday, December 19, 2002 1:31 PM
> > To: IBObjects@yahoogroups.com
> > Subject: Re: [IBO] TIB_Grid ThumbTrack Q
> >
> >
> > I don't follow this 100%. Will you please be more descriptive?
> >
> > Jason Wharton
> > CPS - Mesa AZ
> > http://www.ibobjects.com
> >
> > -- We may not have it all together --
> > -- But together we have it all --
> >
> >
> > ----- Original Message -----
> > From: "Alan McDonald" <alan@...>
> > To: <IBObjects@yahoogroups.com>
> > Sent: Thursday, December 12, 2002 12:04 AM
> > Subject: [IBO] TIB_Grid ThumbTrack Q
> >
> >
> > > When Thumbtrack is set to True, you can scroll the grid to the first
> > record
> > > by tracking the scroll bar to the top. But tracking the scrollbar to
the
> > > bottm leaves the cente cell of the grid highlighted instead of the
last
> > > record/cell.
> > >
> > > Alan