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 » Dynamic Popup Menus Collapse All
Subject Author Date
Eugen Rata Jul 21, 2005 - 3:24 PM

Hello

I have a MDI application.
When I right-click on some MDIChild window there apears one of my popup-menu. The menu has an item which is a popup-item (see below). The contents of that popup-item I must build dynamically.
In your FAQ I found such a code for this
LRESULT CVieweSignal::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
{
CExtPopupMenuWnd::MsgPrepareMenuData_t * pData = reinterpret_cast< CExtPopupMenuWnd::MsgPrepareMenuData_t *>( wParam );
ASSERT( pData != NULL );
CExtPopupMenuWnd * pPopup = pData->m_pPopup;
ASSERT( pPopup != NULL );

int iReplacePos = pPopup->ItemFindPosForCmdID( ID_START_INDICATORS );
TRACE("pos: %d\n", iReplacePos);
if( iReplacePos >= 0 )
{
VERIFY( pPopup->ItemRemove( iReplacePos ) );

pPopup->ItemInsert();
}
return 1;
}

And it works only for first popup menu which apears. It’s not called for any popup-menus which may apear from popup items.
And as I saw from your code, the fucntion ItemFindPosForCmdID is not recursive. So my item is not found and I cannot build the menu.
Check this image http://rata.s5.net/temp/popmenu.png
The item I was talking about is "Basic studies" (popup-item), So I need to find the item "Simple Moving Average" (ID_START_INDICATORS ), remove it, and build another menu instead.
The problem that the event ON_REGISTERED_MESSAGE(CExtPopupMenuWnd::g_nMsgPrepareMenu, OnExtMenuPrepare) is not called when the popup-menu "Simple moving Average" apears, it is called only first time when main popup-menu apears.
How to solve right the problem?

Thx

Technical Support Jul 22, 2005 - 5:32 AM

Starting from Prof-UIS 2.33, there is a CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel registered windows message. This message is also sent by the pop-up menu before it appears on the screen. This message has the same parameters but it is sent separately for each pop-up menu level.