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 » Problems with Toolbar+Combo Message Loop Collapse All
Subject Author Date
Neville Franks Jul 26, 2006 - 2:19 AM

Hi,
I have a Toolbar with a Combo box and when my CMainFrame::OnTextFieldInplaceTextSet() is called I execute various code. This code does a lot of processing and updates the UI. I run into various obscure and hard to replicate problems depending on the operating system version. My guess is that the PeekMessage() loop in CExtBarTextFieldButton::OnInplaceControlRun() and calls to !AfxGetThread()->PumpMessage() are causing the problems I’m seeing.

One example is your Toolbar code going into an endless loop if I repeatedly press Enter in the Combo say 6 times. I assume it is stuck in CExtBarTextFieldButton::OnInplaceControlRun(). Other problems are crashes.

What I want to do is execute my code after your PeekMessage() and PumpMessage() loops have finished, so they can’t interfere with the normal MFC message loop. I tried using PostMessage() in CMainFrame::OnTextFieldInplaceTextSet() to post a message back to my CMainframe but that doesn’t work as your message loop processes the message I post as well.

Can you please suggest the best way to do this.

Thanks,
Neville

Neville Franks Jul 27, 2006 - 8:41 PM

Thanks for the prompt response. Can you please make sure this change is added into your next release.

Technical Support Jul 26, 2006 - 7:27 AM

Thank you for the interesting question. Please find the following code in the CExtBarTextFieldButton::OnInplaceControlRun() method:

    for( MSG msg; ::IsWindow(hWndCtrl); )
    {
        // Process all the messages in the message queue
        while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
 
And replace it with the following code:
 
    for( MSG msg; ::IsWindow(hWndCtrl); )
    {
        // Process all the messages in the message queue
        while(
                PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)
            &&    ::IsWindow(hWndCtrl)
            )
This should let CExtBarTextFieldButton::OnInplaceControlRun() release its control over thread’s message loop. Additionally we guess this problem should not occur with the same text/combo field placed into a popup menu.