CGXView::GetParentTabViewID

static UINT GetParentTabViewID(const CWnd* pWnd);

pWnd

A pointer to the window to be tested. Normally, this.

Return Value

Returns a unique zero-based id for the view in the workbook.

Remarks

In a workbook each view is associated with a unique control id. The id starts with AFX_IDW_PANE_FIRST. Subsequent views are numbered continuously.

GetParentTabViewID simple determines the control id and subtracts AFX_IDW_PANE_FIRST.

Please do not mix this id with the register-index of the tab-beam. You can determine the zero-based register-index by calling

   nTab = GetParentTabWnd()->GetBeam().FindTab(this)
   int nWidth = GetParentTabWnd()->GetBeam().GetTab(nTab).nWidth;

Example

This example illustrates how to use several different grid-views with one document. CGXGridCore owns an m_nViewID. Independent grid-views should get a unique id.

void CGridSampleView::OnInitialUpdate()
{
   if (GetParentTabWnd(this, TRUE) != NULL)
      m_nViewID = GetParentTabViewID(this);
   // constructs Data object, Property object
   // initializes some Data
   CGXGridView::OnInitialUpdate();
}

See Also

 CGXTabWnd  CGXTabWnd::GetBeam  CGXTabBeam::FindTab

CGXView

 Class Overview |  Class Members