|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Mark Feldman
|
Feb 22, 2007 - 2:40 PM
|
Is there an obvious way to know when a tab is clicked when using a CExtTabbedToolControlBar?
thanks, mark
|
|
Mark Feldman
|
Feb 23, 2007 - 11:28 AM
|
Thanks very much for your answer..It seems to be working.. 2 questions
1) Why is it necessary to implement the OnTabWndGetTabImpl function? If my goal is to just determine when a tab is clicked, why do I need to override the painting functionality provided in the CMyTabWnd class. It seems if I comment out the OnTabWndGetTabImpl function, I can still handle the OnTabWndSelectionChange calls.
2) I actually wanted to use a CExtTabbedToolControlBarFlat contol (and not a CExtTabbedControlBar). I would think I could just change the parent class of CMyTabbedBar (i.e)
from: class CMyTabbedBar : public CExtTabbedToolControlBar
to: class CMyTabbedBar : public CExtTabbedToolControlBarFlat
however, doing so results in a crash in CControlBar::OnPaint() when the toolbar is being created..
thanks for your advice... -mark
|
|
Technical Support
|
Feb 24, 2007 - 12:20 PM
|
The complete replacement of the tab page container inside the tabbed tool control bar also requires the complete replacement of the tab control inside the tab page container. Here is a version for the flat bar: class CMyTabWnd : public CExtTWPC < CExtTabFlatWnd >
{
protected:
virtual void OnTabWndEraseClientArea(
CDC & dc,
CRect & rcClient,
CRect & rcTabItemsArea,
CRect & rcTabNearBorderArea,
DWORD dwOrientation,
bool bGroupedMode
)
{
ASSERT_VALID( this );
rcClient;
rcTabItemsArea;
rcTabNearBorderArea;
dwOrientation;
bGroupedMode;
if( ! PmBridge_GetPM()->PaintDockerBkgnd(
true,
dc,
this
)
)
dc.FillSolidRect(
&rcClient,
PmBridge_GetPM()->GetColor(
CExtPaintManager::CLR_3DFACE_OUT
)
);
bool bHorz = OrientationIsHorizontal();
bool bTopLeft = OrientationIsTopLeft();
CRect rcMargin( rcClient );
if( bHorz )
{
if( bTopLeft )
rcMargin.top = rcMargin.bottom - 1;
else
rcMargin.bottom = rcMargin.top + 1;
}
else
{
if( bTopLeft )
rcMargin.left = rcMargin.right - 1;
else
rcMargin.right = rcMargin.left + 1;
}
COLORREF clrMargin;
OnFlatTabWndGetMarginColors( clrMargin );
dc.FillSolidRect( &rcMargin, clrMargin );
}
};
class CMyTabPageContainerWnd : public CExtTabPageContainerFlatWnd
{
public:
virtual CExtTabWnd * OnTabWndGetTabImpl()
{
ASSERT_VALID( this );
return new CMyTabWnd;
}
virtual bool OnTabWndSelectionChange(
LONG nOldItemIndex,
LONG nNewItemIndex,
bool bPreSelectionTest
)
{
bool bRetVal =
CExtTabPageContainerFlatWnd::OnTabWndSelectionChange(
nOldItemIndex,
nNewItemIndex,
bPreSelectionTest
);
if( bPreSelectionTest )
::AfxMessageBox( _T("Tab is about to get selected.") );
else
::AfxMessageBox( _T("Tab has become selected.") );
return bRetVal;
}
};
class CMyTabbedBar : public CExtTabbedToolControlBarFlat
{
protected:
virtual CExtTabPageContainerWnd * OnTabPageContainerCreateObject()
{
ASSERT_VALID( this );
ASSERT( GetSafeHwnd() != NULL );
CExtTabPageContainerWnd * pTabPageContainerWnd = NULL;
try
{
pTabPageContainerWnd = new CMyTabPageContainerWnd;
}
catch( CException * pException )
{
ASSERT( FALSE );
pException->Delete();
pTabPageContainerWnd = NULL;
}
return pTabPageContainerWnd;
}
};
|
|
Technical Support
|
Feb 23, 2007 - 5:29 AM
|
|
|