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 » Displaying message box from text field contained within a toolbar can cause assert/exception Collapse All
Subject Author Date
Kevin Eshbach Sep 23, 2008 - 11:21 AM

I have a text field attached to a toolbar that does validation when the enter key is pressed.  After the enter key is pressed validation is performed on the text in the text field and if the data is bad then a message box describing the error is shown.  Now when the text field is hidden and accessed through a popup menu launched by the chevron on the toolbar an assert and then exception are thrown if the user enters bad data in the text field and presses the enter key.  I’m assuming the assert/exception are happening because the menu has been prematurely destroyed.  Is there any way to keep the popup menu from being destroyed while I display an error message.


 


Here is part of the call stack that shows the assert/exception location.



CExtPopupMenuWnd::MENUITEMDATA & CExtPopupMenuWnd::ItemGetInfo( INT nPos )

{

ASSERT_VALID(

INT nCountOfItems = ItemGetCount();

 

{

ASSERT( FALSE ); <=- Assert being fired off

AfxThrowNotSupportedException();

}

 

}

this ); if( nPos < 0 || nPos >= nCountOfItems ) return _GetItemRef( nPos );

 

void

{

ASSERT_VALID(

 

 

m_bCanceling =

 

{

 

m_pWndParentMenu->_CancelingSet();

}

 

&& ItemGetInfo( m_nCurIndex ).IsPopup()

) <=- Call stack position

{

CExtPopupMenuWnd * pPopup = ItemGetInfo( m_nCurIndex ).GetPopup();

 

pPopup->_CancelingSet();

}

}

CExtPopupMenuWnd::_CancelingSet()this ); if( m_bCanceling ) return;true; if( m_pWndParentMenu != NULL ) if( ! m_pWndParentMenu->_CancelingGet() ) if( m_nCurIndex >= 0 if( ! pPopup->_CancelingGet() )

 

 

#if

_MFC_VER < 0x700

void

CExtPopupMenuWnd::OnActivateApp(BOOL bActive, HTASK hTask)

#else

void

CExtPopupMenuWnd::OnActivateApp(BOOL bActive, DWORD hTask)

#endif

{

ASSERT_VALID(

bActive;

hTask;

_CancelingSet(); <=- Calling stack position

_OnCancelMode();

}

this );

 



 



Kevin Eshbach

Technical Support Sep 24, 2008 - 4:32 AM

This is not completely correct to display a modal dialog like a message box from an in-pace activated controls in toolbars, menus, grids and other controls. You may want to use a CExtPopupMenuTipWnd window instead. This advanced tooltip control can be used for displaying a balloon-like tooltip which the Windows uses in its logon screen near user name and password editors when CAPS LOCK mode is on. You even don’t need to keep your own instance of the CExtPopupMenuTipWnd window. The CExtPopupMenuSite::g_DefPopupMenuSite.GetTip() code returns a reference to the CExtPopupMenuTipWnd window which is used by many controls in Prof-UIS. You can simply show/hide this tip window in balloon or rectangular mode near the in-place activated editor depending on whether the currently entered data is valid. The CExtPopupMenuTipWnd::SetIcon(), CExtPopupMenuTipWnd::SetText() and CExtPopupMenuTipWnd::SetTipStyle() methods allow you to configure look of the advanced tip window. The CExtPopupMenuTipWnd::Show() and CExtPopupMenuTipWnd::Hide() methods allow you to show and hide tip window when needed