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 » Main menu loses focus when captionbar is updated Collapse All
Subject Author Date
Joachim Hartmann Aug 5, 2005 - 1:55 AM

Hi


I have a MDI application using themes, my problem is as follows:


1) Select a menu from the mainframe menu (CExtMenuControlBar), expand that menu (e.g. maybe I want to change the theme or something like that)


2) The mainframe captionbar is updated by SetWindowText


When the caption is updated the menu is "rolled up/disappears". Imagine if the caption updates very quickly, then selecting anything from the mainframe menu becomes impossible.


 


With a standard MDI application (not using ProfUIS) the menu remains when the caption is updated.


 

Technical Support Aug 5, 2005 - 9:58 AM

We tried to change the window caption in our samples when the menu is open (in the way you described) and found no problems. Could you reproduce this problem in one of our samples or in a new test project and send it to us?

Joachim Hartmann Aug 8, 2005 - 2:29 AM

I Used your ThemeColorizer sample application.


To recreate the problem:


1) Add WM_TIMER/OnTimer to CChildForm


In the OnTimer function add the line AfxGetMainWnd()->PostMessage(WM_COMMAND, INCOMING_MSG, 0)


INCOMING_MSG is a user defined message (place a #define INCOMING_MSG WM_USER+100 in MainFrm.h)


2) Add OnCreate to CCHilldFormView


In this function do SetTimer(IDC_TIMER_CAPTION_UPDATE, 1000, NULL) , add #define IDC_TIMER_CAPTION_UPDATE to resource.h with some value.


3) add void OnCaptionMsg() to CMainFrame, the function doesn’t need to do anything,


a blanc void function will do.


 


With this setup, run the app and expand any menu in MainFrame.

Joachim Hartmann Aug 8, 2005 - 4:22 AM

I found a workaround.


If I use ON_MESSAGE instead of ON_COMMAND and change to


PostMessage(INCOMING_MSG, INCOMING_MSG, 0)


Then it works...


 


In my old application WM_COMMAND works just great...odd!!


 

Technical Support Aug 8, 2005 - 6:16 AM

The WM_COMMAND message should work as well as any other message. The problem may be caused by MFC’s command updating mechanism that is based on the OnCmdMsg() virtual method’s calls. This allows you to handle commands not only in the classes which receive the WM_COMMAND messages. We have no idea why commands do not work in your application -- there is not enough information in your message to come to any conclusion. You can send us your project so that we can clarify the problem.