Re: Check/Unchek in PopUp Menu -- Tick mark is not toggleing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 10/07/04


Date: Thu, 7 Oct 2004 13:33:15 -0400


"Kushal Khandelwal" <kushal.khandelwal@gmail.com> wrote in message
news:5f625836.0410070310.116a55e0@posting.google.com
> I am displaying a Pop Up menu on right click of List Control's
> Header(CListCtrl).
>
> This popup menu is having Check/Tick marks. But they are not toggleing
> on subsequent clicks. I am using CMenu's CheckMenuItem( ) function.

In OnHeaderModifiedDateTime, you load the menu, change the check mark,
then let the menu be destroyed. Any changes to it are lost, of course.

In OnNotify, you load the menu again and display it. The menu you
modified in OnHeaderModifiedDateTime has absolutely nothing to do with
the one you show in OnNotify, besides the fact that both are initialized
from the same resource.

Think about it this way. You are reading a file from disk into memory,
modifying it in memory, then just deleting this memory. Later, you are
reading the same file again, and expecting the changes you made earlier
to an in-memory copy to somehow magically make it to the file on disk.

You should either load the menu once, keep it in a member variable or
something, and keep its check marks in sync with the state of the items
in the list view. Or, load it every time as you are doing now, set check
marks appropriately, then show it.

-- 
With best wishes,
    Igor Tandetnik
"On two occasions, I have been asked [by members of Parliament], 'Pray, 
Mr. Babbage, if you put into the machine wrong figures, will the right 
answers come out?' I am not able to rightly apprehend the kind of 
confusion of ideas that could provoke such a question." -- Charles 
Babbage 


Relevant Pages

  • Re: Check/Unchek in PopUp Menu -- Tick mark is not toggleing
    ... > I am displaying a Pop Up menu on right click of List Control's ... > This popup menu is having Check/Tick marks. ... you load the menu again and display it. ... modifying it in memory, ...
    (microsoft.public.vc.language)
  • Dryer Leaves Marks
    ... I have a Maytag Neptune gas dryer Model MDG9700AWW that is only 7 ... It is leaving brown marks on clothing. ... Not every load is ... inside the drum, and the marks are not scorch marks. ...
    (alt.home.repair)
  • Re: Paging Data
    ... your stored procedure (which is, at least imho, the preffered way, using the ... as oposed to having to load all data first. ... > records are displayed almost instantaneasly, but only chunks at a time. ... > displaying them. ...
    (microsoft.public.dotnet.framework)
  • RE: ListView, unstable image size
    ... "Dud Vickers" wrote: ... The tile size is 201,124 and the image size which was initially 43,124 is ... I can load images to the ImageList and then load this to the ListView, ... As well as loading the images I am also loading and displaying the image ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Site does not display properly in IE
    ... except for the size of the images, which does change your spacing. ... IE tries to load ... Publisher will resize and resample your ... And then you need to be sure you are displaying them at 100% ...
    (microsoft.public.publisher.webdesign)