CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Posts
    3

    Question 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

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    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
    Victor Nijegorodov

  3. #3
    Join Date
    May 2010
    Posts
    1

    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 View Post
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured