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 » Context Menu sending different message than the registered in the CommandManager? Collapse All
Subject Author Date
Takis Takoglou Nov 5, 2009 - 2:31 AM

Good day,


I am developing an application where i have registered several commands in the Prof Command Manager.

for example: ID_FILE_NEW , ID_EXIT


Those commands are used in a menu , MENU1 and everything is fine.

Then i create a context menu which contain some of the items of MENU1.

I accomplish this by creating a CExtPopupMenuWnd and using ItemInsert(ID_FILE_NEW ,-1 , ...) etc.

Everything works well when selecting items in the context menu.


The problem is that i need to know if the message when selecting a menu item comes from the context menu or not. Is there a way to either catch the select event of the context menu or perhaps change the message sent by such an event?


An similar trick i use with MFC is setting the
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 11" name="Generator" />
<meta content="Microsoft Word 11" name="Originator" />
<link href="file:///C:\DOCUME~1\skontov\LOCALS~1\Temp\msohtml1\01\clip_filelist.xml" rel="File-List" /><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:PunctuationKerning />
<w:ValidateAgainstSchemas />
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables />
<w:SnapToGridInCell />
<w:WrapTextWithPunct />
<w:UseAsianBreakRules />
<w:DontGrowAutofit />
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]--><style type="text/css">
<!--
/* Font Definitions */
@font-face
    {font-family:SimSun;
    panose-1:2 1 6 0 3 1 1 1 1 1;
    mso-font-alt:宋体;
    mso-font-charset:134;
    mso-generic-font-family:auto;
    mso-font-format:other;
    mso-font-pitch:variable;
    mso-font-signature:1 135135232 16 0 262144 0;}
@font-face
    {font-family:"\@SimSun";
    panose-1:0 0 0 0 0 0 0 0 0 0;
    mso-font-charset:134;
    mso-generic-font-family:auto;
    mso-font-format:other;
    mso-font-pitch:variable;
    mso-font-signature:1 135135232 16 0 262144 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {mso-style-parent:"";
    margin:0in;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:12.0pt;
    font-family:"Times New Roman";
    mso-fareast-font-family:SimSun;
    mso-fareast-language:ZH-CN;}
@page Section1
    {size:8.5in 11.0in;
    margin:1.0in 1.25in 1.0in 1.25in;
    mso-header-margin:.5in;
    mso-footer-margin:.5in;
    mso-paper-source:0;}
div.Section1
    {page:Section1;}
-->
</style><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->MENUINFO
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 11" name="Generator" />
<meta content="Microsoft Word 11" name="Originator" />
<link href="file:///C:\DOCUME~1\skontov\LOCALS~1\Temp\msohtml1\01\clip_filelist.xml" rel="File-List" /><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:PunctuationKerning />
<w:ValidateAgainstSchemas />
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables />
<w:SnapToGridInCell />
<w:WrapTextWithPunct />
<w:UseAsianBreakRules />
<w:DontGrowAutofit />
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]--><style type="text/css">
<!--
/* Font Definitions */
@font-face
    {font-family:SimSun;
    panose-1:2 1 6 0 3 1 1 1 1 1;
    mso-font-alt:宋体;
    mso-font-charset:134;
    mso-generic-font-family:auto;
    mso-font-format:other;
    mso-font-pitch:variable;
    mso-font-signature:1 135135232 16 0 262144 0;}
@font-face
    {font-family:"\@SimSun";
    panose-1:0 0 0 0 0 0 0 0 0 0;
    mso-font-charset:134;
    mso-generic-font-family:auto;
    mso-font-format:other;
    mso-font-pitch:variable;
    mso-font-signature:1 135135232 16 0 262144 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {mso-style-parent:"";
    margin:0in;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:12.0pt;
    font-family:"Times New Roman";
    mso-fareast-font-family:SimSun;
    mso-fareast-language:ZH-CN;}
@page Section1
    {size:8.5in 11.0in;
    margin:1.0in 1.25in 1.0in 1.25in;
    mso-header-margin:.5in;
    mso-footer-margin:.5in;
    mso-paper-source:0;}
div.Section1
    {page:Section1;}
-->
</style><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->dwStyle of a CMENU to MNS_NOTIFYBYPOS, so that the messages sent are of type WM_MENUCOMMAND and i can distinguish them from my other menus.


Thanx in advance.


 

Technical Support Nov 5, 2009 - 1:32 PM

You can track your context menu using the TPMX_DO_MESSAGE_LOOP flag. This means the CExtPopupMenuWnd::TrackPopupMenu() will not return the execution control until menu is displayed on the screen. This allows you to save some flag variable indicating the context menu mode.