CDockablePane AutHide issue
Hi guys,
Looking for some help..
In my current assignment, its needed to hide all the Dockeble panes and to get them back as they where before hiding. during hidden period, they should not be visible/available to the user. it is some how like closing the project and opening a new project in the Visual studio IDE.
However it is working fine with al the panes until they are not in the AutoHide mode. to resolve the issue, i first set Checked the Auto Hide state, if its true, then i set it to false.
Now as on getting back i want to turn the pane back in the Autohide state, i set it by calling the function:
SetAutoHideMode(TRUE, CBRS_ALIGN_ANY);
but then the application crashes :(
Here is the snap of the code to clear the problem: -
To Save the state, i did this:-
pPane is the pointer of the CDockablePane
m_nState = 0;
if(pPane->m_hWnd)
{
if(pPane->IsDocked() && pPane->IsAutoHideMode())
{
pPane->ToggleAutoHide();
m_nState = 1;
}
else if(pPane->IsVisible())
{
m_nState = 2;
}
pPane->ShowPane(FALSE, FALSE, FALSE);
}
To Set the previous state i did this:-
Here since i have passed the pointer with CPane
if(m_nState == 0)
{
return;
}
pPane->ShowPane(TRUE, FALSE, TRUE);
if((m_nState == 1) && pPane->IsDocked() && !pPane->IsAutoHideMode())
{
pPane->SetAutoHideMode(TRUE, CBRS_ALIGN_ANY);
}
And then It calles crash at BOOL CDockablePane::CheckStopSlideCondition(BOOL bDirection).
Regards
Harsh Shankar
VC++ developer
Re: CDockablePane AutHide issue
1. Define "crash".
2. Use Debugger + CallStack to find out where (in what file/line) it "crashes" and why.
3. Please, always use Code tags while posting code snippets!
See http://www.codeguru.com/forum/misc.php?do=bbcode
Re: CDockablePane AutHide issue
I realize I'm four months late, but I had the same problem and it beat the crap out of me. It turns out, you can't pass CBRS_ALIGN_ANY, but have to pass the current alignment (i.e., GetCurrentAlignment()). I ended up doing this:
Code:
CPaneDivider* pDefaultSlider = m_pPanel->GetDefaultPaneDivider();
ASSERT( pDefaultSlider ); // This must be valid (and the panel docked to a frame).
m_pPanel->SetAutoHideMode(FALSE, pDefaultSlider->GetCurrentAlignment());
Steve
Quote:
Originally Posted by
shankar.harsh
Hi guys,
Looking for some help..
In my current assignment, its needed to hide all the Dockeble panes and to get them back as they where before hiding. during hidden period, they should not be visible/available to the user. it is some how like closing the project and opening a new project in the Visual studio IDE.
However it is working fine with al the panes until they are not in the AutoHide mode. to resolve the issue, i first set Checked the Auto Hide state, if its true, then i set it to false.
Now as on getting back i want to turn the pane back in the Autohide state, i set it by calling the function:
SetAutoHideMode(TRUE, CBRS_ALIGN_ANY);
but then the application crashes :(
Here is the snap of the code to clear the problem: -
To Save the state, i did this:-
pPane is the pointer of the CDockablePane
m_nState = 0;
if(pPane->m_hWnd)
{
if(pPane->IsDocked() && pPane->IsAutoHideMode())
{
pPane->ToggleAutoHide();
m_nState = 1;
}
else if(pPane->IsVisible())
{
m_nState = 2;
}
pPane->ShowPane(FALSE, FALSE, FALSE);
}
To Set the previous state i did this:-
Here since i have passed the pointer with CPane
if(m_nState == 0)
{
return;
}
pPane->ShowPane(TRUE, FALSE, TRUE);
if((m_nState == 1) && pPane->IsDocked() && !pPane->IsAutoHideMode())
{
pPane->SetAutoHideMode(TRUE, CBRS_ALIGN_ANY);
}
And then It calles crash at BOOL CDockablePane::CheckStopSlideCondition(BOOL bDirection).
Regards
Harsh Shankar
VC++ developer