Re: Check/Unchek in PopUp Menu -- Tick mark is not toggleing
From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 10/07/04
- Next message: M: "Re: getting size of CWnd"
- Previous message: Chi: "reuse returned HTREEITEM later?"
- In reply to: Kushal Khandelwal: "Check/Unchek in PopUp Menu -- Tick mark is not toggleing"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: M: "Re: getting size of CWnd"
- Previous message: Chi: "reuse returned HTREEITEM later?"
- In reply to: Kushal Khandelwal: "Check/Unchek in PopUp Menu -- Tick mark is not toggleing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|