Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Hide and Select Pane Crashes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Hide and Select Pane Crashes

 Post Reply Post Reply
Author
Message
Sorcerysoft View Drop Down
Newbie
Newbie
Avatar

Joined: 29 October 2004
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sorcerysoft Quote  Post ReplyReply Direct Link To This Post Topic: Hide and Select Pane Crashes
    Posted: 29 October 2004 at 3:03pm

The code below causes our application to crash. I've tried a few variations of the code such as hiding and showing the pane by calling CXTPDockingPaneManager::HidePane() and CXTPDockingPaneManager::ShowPane(). Can someone help me resolve this problem? Thanks.

---CODE------------------------------------

LRESULT CCustomJobFrame::OnToggleViewCustomJobItems( WPARAM wParam, LPARAM lParam )
{
 CXTPDockingPane *pDockingPane = m_paneManager.FindPane( IDR_CUSTOMJOBITEMDATA );

 if( pDockingPane != NULL )
 {
  if( pDockingPane->IsHidden() )
  {
   pDockingPane->Select();
  }
  else
  {
   pDockingPane->Hide();
  }
 }
 return 0;
}

---CALLSTACK---------------------------------

CWnd::Invalidate(int 0) line 126 + 43 bytes
CXTPDockingPaneAutoHidePanel::ShowPane(CXTPDockingPane * 0x0214f938 {CXTPDockingPane}, int 1) line 817
CXTPDockingPaneTabbedContainer::Show() line 720
CXTPDockingPaneManager::ShowPane(CXTPDockingPane * 0x0214f938 {CXTPDockingPane}) line 587
CXTPDockingPane::Select() line 154
CCustomJobFrame::OnToggleViewCustomJobItems(unsigned int 192, long 2686977) line 290 + 11 bytes
CWnd::OnWndMsg(unsigned int 1575, unsigned int 192, long 2686977, long * 0x0012f8a8) line 1815 + 17 bytes
CWnd::WindowProc(unsigned int 1575, unsigned int 192, long 2686977) line 1585 + 30 bytes
AfxCallWndProc(CWnd * 0x02112018, HWND__ * 0x015409c8, unsigned int 1575, unsigned int 192, long 2686977) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x015409c8, unsigned int 1575, unsigned int 192, long 2686977) line 368
AfxWndProcBase(HWND__ * 0x015409c8, unsigned int 1575, unsigned int 192, long 2686977) line 220 + 21 bytes
USER32! 77d48709()
USER32! 77d487eb()
USER32! 77d4c00e()
USER32! 77d4e366()
CXTPHookManager::HookWndProc(HWND__ * 0x015409c8, unsigned int 1575, unsigned int 192, long 2686977) line 101 + 28 bytes


---CRASHES HERE----------------------------

void CXTPDockingPaneAutoHidePanel::ShowPane(CXTPDockingPane* pPane, BOOL bSetFocus)
{
...
 Invalidate(FALSE);
...
}

_AFXWIN_INLINE void CWnd::Invalidate(BOOL bErase)
 { ASSERT(::IsWindow(m_hWnd)); ::InvalidateRect(m_hWnd, NULL, bErase); }

m_hWnd = NULL

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 01 November 2004 at 3:37am

Thought 1.

may be you forget to call

paneManager.InstallDockingPanes(this); in OnCreate()

 

Thought 2.

m_hWnd of CXTPDockingPaneAutoHidePanel is null only if you call

OnToggleViewCustomJobItems before any WM_SIZE event of CCustomJobFrame. (f.e. in OnCreate method) if so call RecalcLayout before you call OnToggleViewCustomJobItems.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Sorcerysoft View Drop Down
Newbie
Newbie
Avatar

Joined: 29 October 2004
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sorcerysoft Quote  Post ReplyReply Direct Link To This Post Posted: 01 November 2004 at 12:06pm

Thought 1 isnt possible because the panes are created and visible.

Thought 2 worked.

Thanks.

LRESULT CCustomJobFrame::OnToggleViewCustomJobItems( WPARAM wParam, LPARAM lParam )
{
 RecalcLayout();

 CXTPDockingPane *pDockingPane = m_paneManager.FindPane( IDR_JOBITEM );

 if( pDockingPane != NULL )
 {
  if( !pDockingPane->IsFloating() )
  {
   if( pDockingPane->IsHidden() )
   {
    pDockingPane->Select();
   }
   else
   {
    pDockingPane->Hide();
   }
  }
 }
 return 0;
}



Edited by Sorcerysoft
Back to Top
spike View Drop Down
Groupie
Groupie


Joined: 13 May 2003
Location: United States
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote spike Quote  Post ReplyReply Direct Link To This Post Posted: 01 November 2004 at 7:04pm

Oleg,

FYI, There is a bug in DockPane() internally it calls GetPaneDirection which always returns DockLeftOf. The only way we found to restore a panes "dock position" was to call ShowPane then DockPane (which flickers the pane in the rect you specify before docking it in its previous state).

Back to Top
Sorcerysoft View Drop Down
Newbie
Newbie
Avatar

Joined: 29 October 2004
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sorcerysoft Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2004 at 12:35pm

This was our work-around for the GetPaneDirection() problem:

LRESULT CCustomJobFrame::OnToggleViewCustomJobItems( WPARAM wParam, LPARAM lParam )
{
 RecalcLayout();
  ...
 CXTPDockingPane *pDockingPane = m_paneManager.FindPane( IDR_JOBITEM );
 if( pDockingPane != NULL )
 {
  
if( pDockingPane->IsHidden() || bForceShow == TRUE )
  {
   CRect rc(-100, -100, -150, -150 );
   m_paneManager.FloatPane( pDockingPane, rc );
   m_paneManager.ToggleDocking( pDockingPane );
  }
  else
  {
   pDockingPane->Hide();
   ...
  }
 }
 return 0;
}


Thanks!



Edited by Sorcerysoft
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2004 at 3:54am

my suggestion is to move RecalcLayout before first call of OnToogleCustomJobItem of OnCreate method

and call m_paneManager.SyncPanesState() after RecalcLayout.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
viktor View Drop Down
Newbie
Newbie


Joined: 03 August 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote viktor Quote  Post ReplyReply Direct Link To This Post Posted: 03 August 2007 at 6:15am
I have encountered similar problem, however with different conditions.
 
// Select panes
for( int i = nPaneCount - 1; i >= 0; i-- )
{
    CXTPDockingPane* pPane = pDockManager->FindPane( sPane.nID );
   BOOL bShowRight = this->CheckShowPaneRight( sPanes.nID );
   if( sPanes.bShowPane && bShowRight )
   {
      if( pPane )
        pDockManager->ShowPane( pPane );
   }
  else
  {
     if( bShowRight )
     {
       if( pPane )
         pDockManager->HidePane( pPane );
     }
    else
    {
       if( pPane )
        pDockManager->ClosePane( pPane );
    } // else
  } // else
  pDockManager->RecalcFramesLayout();
}
 
I need to call RecalcFramesLayout inside the cycle, put it ahead of it does not help.
If I dont recalculate frames, Invalidate method in AutoHidePanel also fails, however hWnd of AutoHidePanel is not NULL, it's got a value, however ASSERT( ::IsWindow( hWnd ) ) in CWnd::Invalidate fails.
 
If all panes are set to ShowPane, this does not happen.
 
InstallDockingPanes is certainly called and the code above is called after OnCreate
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 03 August 2007 at 8:27am
Hello,
try to call RecalcLayout(); before this cycle.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
viktor View Drop Down
Newbie
Newbie


Joined: 03 August 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote viktor Quote  Post ReplyReply Direct Link To This Post Posted: 03 August 2007 at 1:00pm
I tried CFrameWnd::RecalcLayout, however does not help.
Still crashes.
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 August 2007 at 2:16am
Hello,
I need some sample to trace in my side. Maybe you can try modify our samples with your code ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.