f



CDialog - Cannot set check mark to menu Item

I've got a simple menu, created it in the resource editor and made it the
menu for my main Dialog window. (CRSMDlg)

How do I get my menu to display a check / tick box next to the item when I
click on it. I tried adding the ON_UPDATE_COMMAND_UI event handler but no
matter what I do the menu item is not "ticked"  :

void CRSMDlg::OnUpdateOps(CCmdUI *pCmdUI) {
    pCmdUI->SetCheck(1);

}

Is there an update / repaint method I must call, some property I must set on
the Dialog box to inform it ?

Also I found that the shortcut keys does not display when you click on File,
but if you keep the ALT button , then only it displays it - can we switch
this behaviour off ?





0
PIETER
4/21/2005 6:30:55 AM
comp.windows.tools.mfc 1371 articles. 0 followers. Post Follow

2 Replies
317 Views

Similar Articles

[PageSpeed] 16

void CMenuDlg::OnMnuChk_Click()
{
 CMenu * cm = GetMenu();
 if( cm->CheckMenuItem( IDR_MNU_CHK, MF_CHECKED ) == 0 ) {
  cm->CheckMenuItem( IDR_MNU_CHK, MF_CHECKED );
 } else {
  cm->CheckMenuItem( IDR_MNU_CHK, MF_UNCHECKED );
 }
 UpdateData( false );
}


"PIETER CLAASSENS" <erica.altini@blueyonder.co.uk> schreef in bericht 
news:zMH9e.9897$gz2.6493@fe3.news.blueyonder.co.uk...
> I've got a simple menu, created it in the resource editor and made it the
> menu for my main Dialog window. (CRSMDlg)
>
> How do I get my menu to display a check / tick box next to the item when I
> click on it. I tried adding the ON_UPDATE_COMMAND_UI event handler but no
> matter what I do the menu item is not "ticked"  :
>
> void CRSMDlg::OnUpdateOps(CCmdUI *pCmdUI) {
>    pCmdUI->SetCheck(1);
>
> }
>
> Is there an update / repaint method I must call, some property I must set 
> on
> the Dialog box to inform it ?
>
> Also I found that the shortcut keys does not display when you click on 
> File,
> but if you keep the ALT button , then only it displays it - can we switch
> this behaviour off ?
>
>
>
>
> 


0
moi
4/21/2005 11:11:29 AM
Thx moi , I also found the following link that solved my problem - 
http://support.microsoft.com/default.aspx?scid=kb;en-us;242577




Regards

Pieter



"moi" <coffeecop@_NOSPAM_planet.nl> wrote in message 
news:d482dd$43p$1@reader11.wxs.nl...
>
> void CMenuDlg::OnMnuChk_Click()
> {
> CMenu * cm = GetMenu();
> if( cm->CheckMenuItem( IDR_MNU_CHK, MF_CHECKED ) == 0 ) {
>  cm->CheckMenuItem( IDR_MNU_CHK, MF_CHECKED );
> } else {
>  cm->CheckMenuItem( IDR_MNU_CHK, MF_UNCHECKED );
> }
> UpdateData( false );
> }
>
>
> "PIETER CLAASSENS" <erica.altini@blueyonder.co.uk> schreef in bericht 
> news:zMH9e.9897$gz2.6493@fe3.news.blueyonder.co.uk...
>> I've got a simple menu, created it in the resource editor and made it the
>> menu for my main Dialog window. (CRSMDlg)
>>
>> How do I get my menu to display a check / tick box next to the item when 
>> I
>> click on it. I tried adding the ON_UPDATE_COMMAND_UI event handler but no
>> matter what I do the menu item is not "ticked"  :
>>
>> void CRSMDlg::OnUpdateOps(CCmdUI *pCmdUI) {
>>    pCmdUI->SetCheck(1);
>>
>> }
>>
>> Is there an update / repaint method I must call, some property I must set 
>> on
>> the Dialog box to inform it ?
>>
>> Also I found that the shortcut keys does not display when you click on 
>> File,
>> but if you keep the ALT button , then only it displays it - can we switch
>> this behaviour off ?
>>
>>
>>
>>
>>
>
> 


0
Pieter
4/21/2005 10:24:49 PM
Reply: