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 Tech Support » Assertion in CExtBarTextFieldButton::SetSeparatedDropDown() Collapse All
Subject Author Date
Robert Webb Sep 16, 2008 - 2:57 AM

Hi,


For some reason our code hits a whole bunch of assertions via CExtBarTextFieldButton::SetSeparatedDropDown().  The code for this routine always asserts, so clearly it’s never supposed to be called.  We are not calling it directly, rather we’re calling EnableCustomization() and it gets called via there.  It appears to be called for combo boxes we have on some toolbars, so yes they’re text fields wiht drop-downs, but why should that be a problem?


 


Thanks,


Rob.

Technical Support Sep 24, 2008 - 5:06 AM

There is a StyleEditor sample that demonstrates how to use built-in combo fields in customizable toolbars and menus.

Robert Webb Sep 17, 2008 - 12:26 AM

Here’s a stack trace:


>    ProfUIS283nd.dll!CExtBarTextFieldButton::SetSeparatedDropDown(bool bSeparatedDropDown=true) Line 3265 + 0x17 bytes    C++

ProfUIS283nd.dll!CExtBarButton::OnCustomizeUpdateProps(CExtCustomizeCmdTreeNode * pNode=0x0f931ae0) Line 3576 + 0x11 bytes    C++

ProfUIS283nd.dll!CExtCustomizeSite::OnCreateToolbarButton(CExtToolControlBar * pBar=0x0f734258, CExtCustomizeCmdTreeNode * pNodeI=0x0f931ae0, CExtCustomizeCmdTreeNode * pNodeC=0x0f931ae0) Line 8392 + 0x16 bytes    C++

ProfUIS283nd.dll!CExtToolControlBar::OnCustomizeUpdateInitialBarState(CExtCustomizeCmdTreeNode * pParentNode=0x0f931c50, bool bRecalcLayout=false) Line 14012 + 0x2a bytes    C++

ProfUIS283nd.dll!CExtCustomizeSite::OnRegisterToolBar(CExtToolControlBar * pToolBar=0x0f734258) Line 8864 + 0x1b bytes    C++

ProfUIS283nd.dll!CExtCustomizeSite::EnableCustomization(CWnd * pWndTop=0x0e906118, unsigned long dwCustomizeFlags=39) Line 6879 + 0x16 bytes    C++

cadwind.exe!CMainFrame::CreateCadAppToolBars() Line 1075 + 0x17 bytes    C++

cadwind.exe!CMainFrame::OnCreate(tagCREATESTRUCTA * lpCreateStruct=0x0012f108) Line 595 + 0x8 bytes    C++

mfc80d.dll!CWnd::OnWndMsg(unsigned int message=1, unsigned int wParam=0, long lParam=1241352, long * pResult=0x0012edcc) Line 2000 + 0xd bytes    C++

mfc80d.dll!CWnd::WindowProc(unsigned int message=1, unsigned int wParam=0, long lParam=1241352) Line 1741 + 0x20 bytes    C++

cadwind.exe!CExtNCW<CMDIFrameWnd>::WindowProc(unsigned int message=1, unsigned int wParam=0, long lParam=1241352) Line 426 + 0x14 bytes    C++

mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0e906118, HWND__ * hWnd=0x00151620, unsigned int nMsg=1, unsigned int wParam=0, long lParam=1241352) Line 240 + 0x1c bytes    C++

mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x00151620, unsigned int nMsg=1, unsigned int wParam=0, long lParam=1241352) Line 389    C++

mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x00151620, unsigned int nMsg=1, unsigned int wParam=0, long lParam=1241352) Line 411 + 0x15 bytes    C++

user32.dll!7e418734()     

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

user32.dll!7e418816()     

user32.dll!7e418734()     

user32.dll!7e41b4c0()     

user32.dll!7e41f9fe()     

ntdll.dll!_KiUserCallbackDispatcher@12() + 0x13 bytes    

user32.dll!7e41fe13()     

user32.dll!7e41fdd9()     

ntdll.dll!_RtlFreeHeap@12() + 0x130 bytes    

ntdll.dll!_RtlAllocateHeap@12() + 0xd7 bytes    

ntdll.dll!_RtlpCoalesceFreeBlocks@16() + 0x33c bytes    

0018fde0()


Thanks,

Rob.

Technical Support Sep 17, 2008 - 5:56 AM

It looks like you may have configured some of command tree nodes as both a split button in a toolbar and as a text field. This is not correct. The text fields cannot be split buttons at the same time.

Robert Webb Sep 19, 2008 - 2:01 AM

Isn’t a combo box a text field with a drop-down button?  That’s what these are.


We derive new classes from CExtBarTextFieldButton, and call its constructor with the first argument true to create combo boxes.  I don’t think we ever set the __ECTN_TBB_SEPARATED_DROPDOWN style for those items, unless it happens indirectly somehow.  These are being used on toolbars not ribbon bars, by the way.


Hmm, a little further investigation, and it looks like the flag is set in CExtBarButton::OnCustomizeNodeInit(), line 3709:


    if( GetSeparatedDropDown() || pCmdItem->StateIsSeparatedDD() )

        dwAddFlags |= __ECTN_TBB_SEPARATED_DROPDOWN;


GetSeparatedDropDown() returns true after calling IsComboTextField() which returns true, so the flag is set.  So it seems Prof-UIS code is setting this flag for combo boxes.  Is that right or wrong?


Thanks,


Rob.

Technical Support Sep 24, 2008 - 5:09 AM

Yes, the same style of the command tree node is used both by split buttons and text/combo fields. But combo field is not a kind of split button. The split button is an advanced version of the simple push button. The main difference between a simple button and a split button is that the latter uses two command identifiers. The combo field button works with text displayed in its the editor part and its single identifier is never used for sending command messages.

Robert Webb Sep 25, 2008 - 4:11 AM

Looking at the StyleEditor demo, it uses pCmdItem->StateSetCombo() etc to make the control a combo.  We however are deriving a new class from CExtBarTextFieldButton, and replacing the toolbar button with our control, roughly as follows:


    pCmdItem->StateSetResizable();
    pCmdItem->m_nTextFieldWidth = 50;
    pCmdItem->StateSetCombo();
    pCmdItem->StateSetTextFieldNotEditable();

    ourComboButton->SetBar(this);

    if (!InsertSpecButton(index, ourComboButton, FALSE))
    return E_FAIL;

    RemoveButton(index + 1); // remove place holder button



Is there something wrong with that approach?  It seems to lead to the assertion reported above, but otherwise works fine.



Thanks,

Rob.

Technical Support Sep 26, 2008 - 12:24 PM

We don’t see any problems. The CExtBarTextFieldButton class is derived from CExtBarButton. It’s possible to create your CExtBarTextFieldButton-derived class and implement required virtual methods in it (the same as implemented in the CExtBarTextFieldButton class) and optionally invoke methods of the CExtBarButton class from them. This will convert a text field button into a push button.

Robert Webb Sep 23, 2008 - 3:25 AM

Any thoughts on my last message?


Do any of your samples have combo boxes on toolbars?  I’d like to see what they do differently.


Thanks,


Rob.

Technical Support Sep 16, 2008 - 9:45 AM

We believe this problem may have to do with some specifics of your project only. Could you show us the stack trace when the first assertion occurs or help us reproduce this problem using any of our sample projects?