CGXGridWnd::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 window 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 simply determines the control id and subtracts AFX_IDW_PANE_FIRST.

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 CGridSampleWnd::OnInitialUpdate()
{
   if (GetParentTabWnd(this, TRUE) != NULL)
      m_nWndID = GetParentTabViewID(this);
   // constructs Data object, Property object
   // initializes some Data
   CGXGridWnd::OnInitialUpdate();
}

See Also

 CGXTabWnd  CGXTabWnd::GetBeam  CGXTabBeam::FindTab

CGXGridWnd

 Class Overview |  Class Members