Why the polymorphism in CDockablePane::OnLButtonUp() in handling HTMAXBUTTON?
-
Friday, April 27, 2012 12:58 PM
In a Visual Studio project with dockable panes, when you press the hide button on the caption bar of the dockable pane, auto-hide is set and unset.
The clicking on the dockable-pane caption bar is eventually handled by CDockablePane::OnLButtonUp().
What's puzzling me is that the exact same method call calls two different methods depending on the docked mode.
The exact same function call, two different destination functions. How is this even possible? What am I missing here?
void CDockablePane::OnLButtonUp(UINT nFlags, CPoint point) { ...some code here case HTMAXBUTTON: ...some code here else { if (pDockManager != NULL && pDefaultSlider != NULL && (pDefaultSlider->GetCurrentAlignment() & pDockManager->GetEnabledAutoHideAlignment())) { SetAutoHideMode(!m_bPinState, pDefaultSlider->GetCurrentAlignment()); } } return; ...some code here }
Code Snippet 1: The highlighted method calls either CDockablePane::SetAutoHideMode() or CBaseTabbedPane::SetAutoHideMode() depending on the auto-hide mode. How is this possible?
All Replies
-
Friday, April 27, 2012 1:12 PM
I think I just asked a dumb question.
My bet is that while the dockable-pane is un-hidden, it is contained in CBaseTabbedPane, hence CBaseTabbedPane::SetAutoHideMode() is called.
When the dockable-pane is hidden, it is on its own, so CDockablePane::SetAutoHideMode() is called.
- Marked As Answer by NextGenCoder Friday, April 27, 2012 1:12 PM
-
Monday, April 30, 2012 9:10 AMModerator
Thanks for sharing the solution.
Best regards,
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us

