def bounds_check
      h = scrollatrow()
      rc = row_count
      @old_toprow = @toprow

      @_header_adjustment ||= 0
      @current_index = 0 if @current_index < 0  # not lt 0
      @current_index = rc-1 if @current_index >= rc && rc>0 # not gt rowcount
      @toprow = rc-h-1 if rc > h && @toprow > rc - h - 1 # toprow shows full page if possible
      # curr has gone below table,  move toprow forward
      if @current_index - @toprow > h
        @toprow = @current_index - h
      elsif @current_index < @toprow
        # curr has gone above table,  move toprow up
        # sometimes current row gets hidden below header line
        @toprow = @current_index - (@_header_adjustment ||0)
        # prev line can make top row -1, however, if we are going back, lets 
        # put it at start of page, so first or second row is not hidden
        @toprow = 0 if @toprow < h
      end

      @row_changed = false
      if @oldrow != @current_index
        on_leave_row @oldrow if respond_to? :on_leave_row     # to be defined by widget that has included this
        on_enter_row @current_index   if respond_to? :on_enter_row  # to be defined by widget that has included this
        set_form_row
        @row_changed = true
      end
      #set_form_row # 2011-10-13 

      if @old_toprow != @toprow # only if scrolling has happened should we repaint
        @repaint_required = true #if @old_toprow != @toprow # only if scrolling has happened should we repaint
        @widget_scrolled = true
      end
    end
def bounds_check
      h = scrollatrow()
      rc = row_count
      @old_toprow = @toprow

      @_header_adjustment ||= 0
      @current_index = 0 if @current_index < 0  # not lt 0
      @current_index = rc-1 if @current_index >= rc && rc>0 # not gt rowcount
      @toprow = rc-h-1 if rc > h && @toprow > rc - h - 1 # toprow shows full page if possible
      # curr has gone below table,  move toprow forward
      if @current_index - @toprow > h
        @toprow = @current_index - h
      elsif @current_index < @toprow
        # curr has gone above table,  move toprow up
        # sometimes current row gets hidden below header line
        @toprow = @current_index - (@_header_adjustment ||0)
        # prev line can make top row -1, however, if we are going back, lets 
        # put it at start of page, so first or second row is not hidden
        @toprow = 0 if @toprow < h
      end

      @row_changed = false
      if @oldrow != @current_index
        on_leave_row @oldrow if respond_to? :on_leave_row     # to be defined by widget that has included this
        on_enter_row @current_index   if respond_to? :on_enter_row  # to be defined by widget that has included this
        set_form_row
        @row_changed = true
      end
      #set_form_row # 2011-10-13 

      if @old_toprow != @toprow # only if scrolling has happened should we repaint
        @repaint_required = true #if @old_toprow != @toprow # only if scrolling has happened should we repaint
        @widget_scrolled = true
      end
    end
please set oldrow before calling this. Store current_index as oldrow before changing. NOTE