Jump to content


Photo

On scrolling, possible to scroll past top row with error


  • Please log in to reply
No replies to this topic

#1 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 29 January 2019 - 04:14 PM

Hi, Boki:

 

Have a consistent error when scrolling grids down, then up to their top row. (Now I am using Delphi 10.2.)

 

I get an error in madExcept for the row = -1 and also a showmessage error from your code.

 

What can I do to keep this error and your showmessage from firing?

 

In my code for OnVerticalScroll:

 

WITH Grid DO
  BEGIN
    // if using scroll bar, it can go past the last row index causing a list
    // index out of bounds
    IF (Position > RowCount - 1) OR (Position < 0) THEN
    BEGIN
         exit;
    END;
    Repaint; // needed for XE2 paint problems
  END;
 
The above is not trapping this condition. In your code, 
procedure TNxListGridView6.ScrollContentBy(DeltaX, DeltaY: Integer);
 
if DeltaY < 0 then { Scroll Up }
    begin
      Dec(FFirstIndex);
 
      if FFirstIndex < 0 then
      begin
        ShowMessage('Error: ' + IntToStr(FFirstIndex));
      end;

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users