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 » CExtPopupMenuWnd problem when calling DoModal in command processing Collapse All
Subject Author Date
Damien Castelltort Dec 5, 2006 - 6:26 AM

Hi,

I’m having some problem with CExtPopupMenuWnd since I updated to version 2.62.

I’m loading my proper CMenu, doing operations (hide or disable items) on it and then I create a CExtPopup to track it :

CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd;

pPopup->CreatePopupMenu(GetSafeHwnd());

pPopup->UpdateFromMenu( GetSafeHwnd(),
Menu,
true, // bPopupMenu
true, // bTopLevel
true // bNoRefToCmdMngr
);
pPopup->TrackPopupMenu(TPMX_LEFTALIGN, point.x, point.y);

Some of my menu commands open a simple CDialog. But in this dialog, all my keyboard actions are ignored. I can’t type in an Edit for exemple. The caret is here, but noting append when I type a key.

If I set bNoRefToCmdMngr to false, the CDialog is OK, but if I disable commands at runtime in my Popup Menu, it’s ignored and all the items are enabled.

Do you know how to solve this problem, please ?
Thank you in advance.

Aurelien Loizeau.

Damien Castelltort Feb 16, 2007 - 6:49 AM

Hi, it’s done, I send the project by mail yesterday.

Thank You.

Aurelien

Damien Castelltort Feb 8, 2007 - 9:09 AM

In fact I spoke too quickly ˆˆ

I’ve updated my small exemple (http://aurelien.loizeau.free.fr/profuis/PopupMenu.rar).

I have now a problem if I want to open another popup menu in the sub dialog.
If the sub dialog is called by clicking the button, everything is fine. But if the sub dialog is opened via the popup menu -> the new popup menu called by a right click in the subdlg is not working.

This problem is hapening even with the fix you gave me above.

Thanks for your help again.

AurA©lien Loizeau

Technical Support Feb 11, 2007 - 1:27 PM

Could you please send this project to us at support@prof-uis.com?

Damien Castelltort Dec 13, 2006 - 2:28 AM

Thank you, works great now.

Damien Castelltort Dec 11, 2006 - 4:47 AM

Hi,

I’ve uploaded a very small example here : http://aurelien.loizeau.free.fr/profuis/PopupMenu.rar

Just right click on the dialog and open the subdlg via the popup menu -> the subdlg does not get the inputs (try to type text in the edit).

If bNoRefToCmdMngr is passed to false in the UpdateFromMenu call, the problem is solved.

Thank you

AurA©lien Loizeau

Technical Support Dec 12, 2006 - 4:47 AM

Thank you for reporting this issue. To fix it, please update the CExtPopupMenuSite::_Done() method in the ..\Prof-UIS\Src\ExtPopupMenuWnd.cpp file:

void CExtPopupMenuSite::_Done()
{
    ASSERT( ! m_bShutdownMode );
    if( m_pWndToolTip != NULL )
        m_pWndToolTip->Hide();
    m_bShutdownMode = true;
    m_pWndCapture = NULL;
    m_pWndAnimation = NULL;
    m_lpnResultCmdID = NULL;
    _Hook( false );
    if( m_pTopMenu != NULL )
    {
        ASSERT( m_pTopMenu->m_bTopLevel );
        if( ! m_pTopMenu->_IsFadeOutAnimation() )
        {
            VERIFY( m_pTopMenu->_BuildItems( NULL, true ) );
            if(        m_pTopMenu->GetSafeHwnd() != NULL
                &&    ::IsWindow( m_pTopMenu->GetSafeHwnd() )
                )
            {
                CExtControlBar::stat_SetMessageString(
                    m_pTopMenu->GetOwner()
                    );
                m_pTopMenu->DestroyWindow();
                MSG msg;
                while( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
                {
                    if( WM_MOUSEFIRST <= msg.message && msg.message <= WM_MOUSELAST )
                    {
                        ::PeekMessage( &msg, NULL, msg.message, msg.message, PM_REMOVE );
                        continue;
                    }
                    if( ! ::AfxGetThread()->PumpMessage() )
                        break;
                }
            }
            ASSERT( m_pTopMenu->GetSafeHwnd() == NULL );
            delete m_pTopMenu;
        }
        m_pTopMenu = NULL;
    }
    __VPC_VERIFY_0;
    m_bShutdownMode = false;
}


Technical Support Dec 5, 2006 - 1:07 PM

We cannot confirm this problem yet. Would you send us a project (with a dialog and the context menu tracking code only) that demonstrates the problem?