Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Problem update size (CExtStatusControlBar: WidthFromContent) Collapse All
Subject Author Date
Adrian Ineichen Feb 24, 2011 - 3:35 AM

Hello

I add two panes to the status control bar (First pane: text with icon; Second pane: eg. slider control). Because the size is not optimal I update the width. Then an Assert occurs!

If I change the order or leave out the icon, the problem is solved. But to change the order is not useful in our application.

 

Regards,

Code segment (example StatusPane):

        //Add text indicator

             bool bRet = m_pMainFrame->m_wndStatusBar.AddPane(IDS_PANE_TEXT,m_nPosition);

             if(!bRet){

                    AfxMessageBox(_T("Pane index out of range\nor pane with same ID already exists in the status bar"), MB_ICONERROR);

                    return;

             }

 

        //Add Icon

        HICON hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_HOST), IMAGE_ICON, 16, 16, LR_SHARED);

        int iIndex = m_pMainFrame->m_wndStatusBar.CommandToIndex(IDS_PANE_TEXT);

        m_pMainFrame->m_wndStatusBar.GetStatusBarCtrl().SetIcon(iIndex, hIcon);

 

 

        //Add slider indicator

             m_pWndSliderCtrl = new CExtStatusBarSliderCtrl;

             if (!m_pWndSliderCtrl->Create(

                    WS_CHILD|WS_VISIBLE|WS_TABSTOP|TBS_HORZ,

                    CRect(0,0,0,0),

                    &m_pMainFrame->m_wndStatusBar,

                    IDC_STATUS_BAR_SLIDER))

             {

                    TRACE(_T("Failed to create slider control.\n"));

                    return;

             }

             m_pWndSliderCtrl->PmBridge_Install();

            

             bRet = m_pMainFrame->m_wndStatusBar.AddPane(IDS_PANE_SLIDER_CTRL,m_nPosition);

             if(!bRet){

                    AfxMessageBox(_T("Pane index out of range\nor pane with same ID already exists in the status bar"), MB_ICONERROR);

                    return;

             }

            

             int nIndex = m_pMainFrame->m_wndStatusBar.CommandToIndex(IDS_PANE_SLIDER_CTRL);

             if (nIndex == -1)

                    return;

            

             m_pMainFrame->m_wndStatusBar.SetPaneWidth(nIndex, 80);

             m_pMainFrame->m_wndStatusBar.SetPaneControl(m_pWndSliderCtrl, IDS_PANE_SLIDER_CTRL, true);

 

        for(int i=0; i<m_pMainFrame->m_wndStatusBar.GetPaneCount(); i++)

        {

            m_pMainFrame->m_wndStatusBar.WidthFromContent(i);

        }

Adrian Ineichen Feb 25, 2011 - 1:01 AM

I use Visual Studio 2010 under Windows 7 64-Bit.


 


Call stack listing:


> ProfUIS290md.dll!CExtStatusControlBar::OnPaintPane(CDC & dc, int nPaneIdx, const CRect & rcPane, unsigned long dwPaneStyle, HICON__ * hIcon, const char * sPaneText, unsigned int nDrawTextFlags)  Line 493 + 0x1f bytes C++

  ProfUIS290md.dll!CExtStatusControlBar::DoPaint(CDC * pDC)  Line 298 + 0x8c bytes C++

  ProfUIS290md.dll!CExtStatusControlBar::OnPaint()  Line 166 + 0x16 bytes C++

  mfc100d.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult)  Line 2354 C++

  mfc100d.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 2067 + 0x20 bytes C++

  mfc100d.dll!CControlBar::WindowProc(unsigned int nMsg, unsigned int wParam, long lParam)  Line 506 + 0x14 bytes C++

  ProfUIS290md.dll!CExtStatusControlBar::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 1984 C++

  mfc100d.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 248 + 0x1c bytes C++

  mfc100d.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 411 C++

  mfc100d.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 420 + 0x15 bytes C++

  user32.dll!75936238()  

  [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll] 

  user32.dll!75937298()  

  user32.dll!75936899()  

  user32.dll!75937177()  

  user32.dll!759372f1()  

  ntdll.dll!779100e6()  

  user32.dll!7593ce75()  

  user32.dll!75942d56()  

  mfc100d.dll!CWnd::UpdateWindow()  Line 138 + 0x3b bytes C++

  ProfUIS290md.dll!CExtStatusControlBar::RepositionControls(bool bUpdate)  Line 1005 C++

  ProfUIS290md.dll!CExtStatusControlBar::WidthFromContent(int nIndex)  Line 1855 C++

  StatusPanes-md.exe!CChildFormView::OnAddPane()  Line 229 + 0x1b bytes C++

  mfc100d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget, unsigned int nID, int nCode, void (void)* pfn, void * pExtra, unsigned int nSig, AFX_CMDHANDLERINFO * pHandlerInfo)  Line 82 C++

  mfc100d.dll!CCmdTarget::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo)  Line 381 + 0x27 bytes C++

  mfc100d.dll!CView::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo)  Line 166 + 0x18 bytes C++

  StatusPanes-md.exe!CChildFormView::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo)  Line 725 + 0x18 bytes C++

  mfc100d.dll!CWnd::OnCommand(unsigned int wParam, long lParam)  Line 2676 C++

  mfc100d.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult)  Line 2081 + 0x1e bytes C++

  mfc100d.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 2067 + 0x20 bytes C++

  StatusPanes-md.exe!CExtWS<CExtAFV<CFormView>,301>::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 1159 C++

  StatusPanes-md.exe!CExtWA<CExtWS<CExtAFV<CFormView>,301> >::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 1805 + 0x14 bytes C++

  mfc100d.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 248 + 0x1c bytes C++

  mfc100d.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 411 C++

  mfc100d.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 420 + 0x15 bytes C++

  user32.dll!75936238()  

  user32.dll!759368ea()  

  user32.dll!75936899()  

  user32.dll!7593cd1a()  

  user32.dll!7595ef40()  

  mfc100d.dll!CWnd::SendMessageA(unsigned int message, unsigned int wParam, long lParam)  Line 42 + 0x44 bytes C++

  ProfUIS290md.dll!CExtButton::_OnClick(bool bSelectAny, bool bSeparatedDropDownClicked)  Line 1891 C++

  ProfUIS290md.dll!CExtButton::OnLButtonUp(unsigned int nFlags, CPoint point)  Line 1835 + 0x3e bytes C++

  mfc100d.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult)  Line 2495 C++

  mfc100d.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 2067 + 0x20 bytes C++

  ProfUIS290md.dll!CExtButton::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 2986 + 0x14 bytes C++

  mfc100d.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 248 + 0x1c bytes C++

  mfc100d.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 411 C++

  mfc100d.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam)  Line 420 + 0x15 bytes C++

  user32.dll!75936238()  

  user32.dll!759368ea()  

  user32.dll!75936899()  

  user32.dll!75937d31()  

  user32.dll!75937dfa()  

  user32.dll!75952292()  

  user32.dll!759570a9()  

  mfc100d.dll!CWnd::IsDialogMessageA(tagMSG * lpMsg)  Line 198 C++

  mfc100d.dll!CWnd::PreTranslateInput(tagMSG * lpMsg)  Line 4660 C++

  mfc100d.dll!CFormView::PreTranslateMessage(tagMSG * pMsg)  Line 234 C++

  StatusPanes-md.exe!CExtWS<CExtAFV<CFormView>,301>::PreTranslateMessage(tagMSG * pMsg)  Line 625 C++

  mfc100d.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop, tagMSG * pMsg)  Line 3258 + 0x14 bytes C++

  mfc100d.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg)  Line 233 + 0x12 bytes C++

  mfc100d.dll!CWinThread::PreTranslateMessage(tagMSG * pMsg)  Line 777 + 0x9 bytes C++

  mfc100d.dll!AfxPreTranslateMessage(tagMSG * pMsg)  Line 252 + 0x11 bytes C++

  mfc100d.dll!AfxInternalPumpMessage()  Line 178 + 0x18 bytes C++

  mfc100d.dll!CWinThread::PumpMessage()  Line 900 C++

  mfc100d.dll!CWinThread::Run()  Line 629 + 0xd bytes C++

  mfc100d.dll!CWinApp::Run()  Line 822 C++

  mfc100d.dll!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow)  Line 47 + 0xd bytes C++

  StatusPanes-md.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow)  Line 26 C++

  StatusPanes-md.exe!__tmainCRTStartup()  Line 547 + 0x2c bytes C

  StatusPanes-md.exe!WinMainCRTStartup()  Line 371 C

  kernel32.dll!75823677()  

  ntdll.dll!77939f02()  

  ntdll.dll!77939ed5()  


 


 


Code replacement (to StatusPane example):



void



CChildFormView::OnAddPane() if( m_nPosition < 0 || m_nPosition > 20 )return;if( m_wndRadioText.GetCheck() ) // text

{


 


//Add text indicator

 


 


AfxMessageBox(_T(


 


}


 


bool bRet = m_pMainFrame->m_wndStatusBar.AddPane(IDS_PANE_TEXT,m_nPosition);if(!bRet){"Pane index out of range\nor pane with same ID already exists in the status bar"), MB_ICONERROR);return;//Add Icon

HICON hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_HOST), IMAGE_ICON, 16, 16, LR_SHARED);


 


m_pMainFrame->m_wndStatusBar.GetStatusBarCtrl().SetIcon(iIndex, hIcon);


 


 


int iIndex = m_pMainFrame->m_wndStatusBar.CommandToIndex(IDS_PANE_TEXT);//Add slider indicator

m_pWndSliderCtrl =


 


WS_CHILD|WS_VISIBLE|WS_TABSTOP|TBS_HORZ,


CRect(0,0,0,0),


&m_pMainFrame->m_wndStatusBar,


IDC_STATUS_BAR_SLIDER))


{


TRACE(_T(


 


}


m_pWndSliderCtrl->PmBridge_Install();


 


bRet = m_pMainFrame->m_wndStatusBar.AddPane(IDS_PANE_SLIDER_CTRL,m_nPosition);


 


AfxMessageBox(_T(


 


}


 


 


 


 


 


m_pMainFrame->m_wndStatusBar.SetPaneWidth(nIndex, 80);


m_pMainFrame->m_wndStatusBar.SetPaneControl(m_pWndSliderCtrl, IDS_PANE_SLIDER_CTRL,


 


new CExtStatusBarSliderCtrl;if (!m_pWndSliderCtrl->Create("Failed to create slider control.\n"));return;if(!bRet){"Pane index out of range\nor pane with same ID already exists in the status bar"), MB_ICONERROR);return;int nIndex = m_pMainFrame->m_wndStatusBar.CommandToIndex(IDS_PANE_SLIDER_CTRL);if (nIndex == -1)return;true);//Update width

 


{


m_pMainFrame->m_wndStatusBar.WidthFromContent(i);


}


}


 


for(int i=0; i<m_pMainFrame->m_wndStatusBar.GetPaneCount(); i++)if( m_wndRadioEdit.GetCheck() ) // edit

{



{


CheckControls();


 


 


 


 


 

Technical Support Feb 24, 2011 - 1:13 PM

Could you show the call stack listing when the assertion occurs? Which Visual Studio and Windows OS version are you using?