Article ID: 223368
Article Last Modified on 6/14/2006
APPLIES TO
- Microsoft Visual J++ 6.0 Standard Edition
This article was previously published under Q223368
SYMPTOMS
When displaying a context menu with submenu items on a control, such as the List View control, the setChecked method does not correctly display a check mark on the context menu's submenu item when a different item is selected.
CAUSE
The WM_INITMENUPOPUP message is not being correctly forwarded to a control's contextMenu.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
MORE INFORMATION
Steps to Reproduce Behavior
- Create a new Windows Application project, Project1, with Visual J++ 6.0.
- Add a WFC List View control, listView1, to the form.
- Select the items properties from listView1's Properties window and add two new items, listItem1 and listItem2.
- Add a WFC ContextMenu control, contextMenu1.
- Select the contextMenu property from the listView1 Properties window and associate it to contextMenu1.
- Double-click on contextMenu1 and one item, menuItem1.
- Continue by adding subitems menuItem2, named small, and menuItem3, named large.
Double-click on menuItem2 and add the following function call to the Click function:
listView1.setView(ViewEnum.SMALLICON);
Double-click on menuItem3 and add the following function call to the Click function:
listView1.setView(ViewEnum.LARGEICON);
Add the following method:
private void contextMenuPopup(Object source, Event e) { MenuItem currentItem = null; switch (listView1.getView()) { case ViewEnum.LARGEICON: currentItem = menuItem3; break; case ViewEnum.SMALLICON: currentItem = menuItem2; break; } menuItem2.setChecked(false); menuItem3.setChecked(false); currentItem.setChecked(true); }
- Select contextMenu1 and, in the Properties window, select the events listing and associate the pop-up event with the contexMenuPopup method created above.
- Compile and run the sample.
- Right-mouse click on List View control and notice the "small" menu item is selected.
- Select the "large" menu item and close the context menu.
- Bring up the context menu again and notice that the "small" menu item is selected.
REFERENCES
For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:
Keywords: kbbug kbfix kbvs600sp3fix KB223368