Microsoft KB Archive/223368

From BetaArchive Wiki

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:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Windows Application project, Project1, with Visual J++ 6.0.
  2. Add a WFC List View control, listView1, to the form.
  3. Select the items properties from listView1's Properties window and add two new items, listItem1 and listItem2.
  4. Add a WFC ContextMenu control, contextMenu1.
  5. Select the contextMenu property from the listView1 Properties window and associate it to contextMenu1.
  6. Double-click on contextMenu1 and one item, menuItem1.
  7. Continue by adding subitems menuItem2, named small, and menuItem3, named large.
  8. Double-click on menuItem2 and add the following function call to the Click function:

    listView1.setView(ViewEnum.SMALLICON);  
                        
  9. Double-click on menuItem3 and add the following function call to the Click function:

    listView1.setView(ViewEnum.LARGEICON);  
                        
  10. 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);
    }
                        
  11. Select contextMenu1 and, in the Properties window, select the events listing and associate the pop-up event with the contexMenuPopup method created above.
  12. Compile and run the sample.
  13. Right-mouse click on List View control and notice the "small" menu item is selected.
  14. Select the "large" menu item and close the context menu.
  15. 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