Print Page | Close Window

Hide and Select Pane Crashes

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=1346
Printed Date: 09 May 2024 at 11:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Hide and Select Pane Crashes
Posted By: Sorcerysoft
Subject: Hide and Select Pane Crashes
Date 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




Replies:
Posted By: Oleg
Date 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


Posted By: Sorcerysoft
Date 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;
}



Posted By: spike
Date 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).



Posted By: Sorcerysoft
Date 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!



Posted By: Oleg
Date 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


Posted By: viktor
Date 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
 


Posted By: Oleg
Date Posted: 03 August 2007 at 8:27am
Hello,
try to call RecalcLayout(); before this cycle.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: viktor
Date Posted: 03 August 2007 at 1:00pm
I tried CFrameWnd::RecalcLayout, however does not help.
Still crashes.
 


Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net