Objective Grid: Incremental column scrolling

Article ID: 122
Last updated: 04 Jun, 2018
Article ID: 122
Last updated: 04 Jun, 2018
Revision: 3
Views: 2179
Posted: 19 Jan, 2001
by Meltreger B.
Updated: 04 Jun, 2018
by Meltreger B.

Problem


When a column is larger than a view, is it possible to incrementally scroll that one column? It seems as if Objective Grid always scrolls a whole column.


Cause



Action


This is because Objective Grid doesn?t support incremental scrolling, but here are two workarounds to this limitation:

Here are the steps for scrolling on a lower interval than the default.

  1. Use covered cells. Check out the SmoothCol sample.
  2. If you are using the Grid in a CView (this workaround won't help if you are using the grid in a dialog), you can derive your view from a CScrollView instead of usual CView. The base class CScrollView will provide incremental scrolling.
  3. This is really simple.
    1. Derive your view class from CScrollView.
    2. Override OnInitialUpdate() as follows:

void CMyScrollView::OnInitialUpdate()
{

// Modify this to suit your needs.
// This is for a list box type
// implementation.

CScrollView::OnInitialUpdate();
CSize sizeTotal;

GXInit();

m_gridWnd=new CGXGridWnd;
m_gridWnd->Create(WS_CHILD|WS_VISIBLE, CRect(0,0,800,800),this, 160);
m_gridWnd->Initialize();
m_gridWnd->SetRowCount(300);
m_gridWnd->SetColCount(1);
m_gridWnd->SetColWidth(1,1,800); // Set the width here

// TODO: calculate the total size of this view
sizeTotal.cx = m_gridWnd->CalcSumOfColWidths(0,m_gridWnd->GetColCount());

sizeTotal.cy = m_gridWnd->CalcSumOfRowHeights(0,m_gridWnd->GetRowCount());

m_gridWnd->MoveWindow(0,0,sizeTotal.cx,sizeTotal.cy );

//This will help incremental scrolling...
SetScrollSizes(MM_TEXT, sizeTotal);

}

m_gridWnd is a member variable declared as below:

CGXGridWnd* m_gridWnd;

This article was:   Helpful | Not helpful
Report an issue
Article ID: 122
Last updated: 04 Jun, 2018
Revision: 3
Views: 2179
Posted: 19 Jan, 2001 by Meltreger B.
Updated: 04 Jun, 2018 by Meltreger B.

Others in this category