CGXView::OnChangedTab
afx_msg LRESULT OnChangedTab(WPARAM wParam, LPARAM lParam);
wParam
Specifies the zero-based register-index.
lParam
No meaning.
Return Value
Meaningless.
Remarks
If you want to handle the WM_GX_CHANGEDTAB message, you should add the following entry to the message-map of your view class:
ON_MESSAGE(WM_GX_CHANGEDTAB, OnChangedTab)
OnChangedTab is called when the sheet-name in the tab-beam has changed. You should handle this message if you want to store the sheet-name in the document. See the example for how to notify other frame-windows of the change.
An example is CGXGridView which handles OnChangedTab to store the sheet-name in the parameter-object.
Example
This example illustrates how to notify other frame-windows about a new sheet-name.
LRESULT CSampleView::OnChangedTab(WPARAM wParam, LPARAM /*lParam*/)
{
CGXTabWnd* pTabWnd = GetParentTabWnd(this, TRUE);
ASSERT(pTabWnd
&& pTabWnd->IsKindOf(RUNTIME_CLASS(CGXTabWnd)));
GetDocument()->m_sSheetName
= pTabWnd->GetBeam().GetTab(wParam).sLabel;
CGXGridHint hint(gxHintChangedTab, m_nViewID);
GetDocument()->UpdateAllViews(this, 0, &hint);
return 0;
}
In OnUpdate, the tab-beam gets actualized.
...
case gxHintChangedTab:
{
CGXTabWnd* pTabWnd = GetParentTabWnd(this, TRUE);
ASSERT(pTabWnd
&& pTabWnd->IsKindOf(RUNTIME_CLASS(CGXTabWnd)));
int nTab = pTabWnd->GetBeam().FindTab(this);
ASSERT(nTab != -1);
pTabWnd->GetBeam().GetTab(nTab).sLabel
= GetDocument()->m_sSheetName;
pTabWnd->GetBeam().AdjustTabSize(nTab);
pTabWnd->GetBeam().Invalidate();
}