Example #1
0
    virtual BOOL on_scroll( HELEMENT he, HELEMENT target, SCROLL_EVENTS cmd, INT pos, BOOL isVertical ) 
    { 
      if(!isVertical)
        return FALSE; 

      int visible_rows = num_data_rows(he);
      int row = first_row_idx;

      switch( cmd )
      {
        case SCROLL_HOME:       row = 0; break;
        case SCROLL_END:        row = num_rows - visible_rows + 1; break;
        case SCROLL_STEP_PLUS:  row += 1; break;
        case SCROLL_STEP_MINUS: row -= 1; break;
        case SCROLL_PAGE_PLUS:  row += visible_rows; break;
        case SCROLL_PAGE_MINUS: row -= visible_rows; break;
        case SCROLL_POS:        row = pos; break;
        default: return FALSE; 
      }

      row = aux::limit(row, 0, num_rows - visible_rows + 1);
      
      if( row == first_row_idx ) return TRUE;

      first_row_idx = row;

      get_rows_data(he);

      dom::scrollbar sb = get_v_scrollbar(he);
      sb.set_values(first_row_idx, 0, num_rows, num_data_rows(he), 1);
      
      return TRUE;

    }
Example #2
0
    virtual BOOL on_event (HELEMENT he, HELEMENT target, BEHAVIOR_EVENTS type, UINT_PTR reason )
    { 
       if( type != INIT_DATA_VIEW ) return FALSE; 

       first_row_idx = 0;
       get_rows_data( he ); 

       dom::scrollbar sb = get_v_scrollbar(he);
       sb.set_values(first_row_idx, 0, num_rows, num_data_rows(he), 1);

       return TRUE;
    }
    virtual BOOL on_scroll( HELEMENT he, HELEMENT target, SCROLL_EVENTS cmd, INT pos, BOOL isVertical ) 
    { 
      if(!isVertical)
        return FALSE; 

      int visible_rows = num_data_rows(he);
      int row = first_row_idx;

      switch( cmd )
      {
        case SCROLL_HOME:       row = 0; break;
        case SCROLL_END:        row = num_rows - visible_rows + 1; break;
        case SCROLL_STEP_PLUS:  row += 1; break;
        case SCROLL_STEP_MINUS: row -= 1; break;
        case SCROLL_PAGE_PLUS:  row += visible_rows; break;
        case SCROLL_PAGE_MINUS: row -= visible_rows; break;
        case SCROLL_POS:        row = pos; break;
        default: return FALSE; 
      }

      row = aux::limit(row, 0, num_rows - visible_rows + 1);
      
      if( row == first_row_idx ) return TRUE;

      first_row_idx = row;

      dom::element tbl = get_table(he);
      tbl.update(); // establish update 'umbrella'

      get_rows_data(he);

      dom::scrollbar sb = get_v_scrollbar(he);
      sb.set_values(first_row_idx, 0, num_rows, num_data_rows(he), 1);

      HTMLayoutUpdateWindow(tbl.get_element_hwnd(TRUE));
      
      return TRUE;

    }