Can a menu POPUP be set to CHECKED?

This is a discussion on Can a menu POPUP be set to CHECKED? within the Windows Programming forums, part of the Platform Specific Boards category; Might seem unusual, but I have a use for it if it can be done. I have a menu with ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    161

    Can a menu POPUP be set to CHECKED?

    Might seem unusual, but I have a use for it if it can be done. I have a menu with a bunch of popups that each have one or two options. I'd like to indicate which POPUP has an item checked, since only 1 from the whole list can be.

  2. #2
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,691
    Maybe. But I'm guessing not, just try it and see.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    I did try defaulting 1 to checked in the resource file and it wouldn't compile. That's why I was asking. Thought maybe POPUPs require different handling to do the same thing.

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,691
    If you where really persistent you could always try to edit the raw menu resource file to include a check on a popup, I recently cracked it, so I could show you if you want.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    What exactly is the issue?

    I use GetMenuItemInfo() and SetMenuItemInfo().

    I find BY_POSITION harder to use than the items ID (as it counts down then across).

    Make sure your handler unchecks all menu items then checks the right menu item.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    Far as I can tell, you can't even asign an ID to a popup. Take PS1 below, for example.

    Code:
    ELF_MENU MENU
    BEGIN
      POPUP "Mode"
      BEGIN
        POPUP "PS1"
        BEGIN
           MENUITEM "ELF",MNU_PS1_ELF,GRAYED
           MENUITEM "RAM",MNU_PS1_RAW
        END
        POPUP "PS2"
        BEGIN
           MENUITEM "ELF",MNU_PS2_ELF
           MENUITEM "RAM",MNU_PS2_RAW
        END

  7. #7
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    You could use some other method for indicating it. Like putting brackets around the popup's caption or some other trick on the string.

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Popups can be given IDs.

    TrackPopupMenuEx() can be asked to return the ID.

    Code:
    IDR_MENU1 MENU 
    BEGIN
        POPUP ""
        BEGIN
            MENUITEM "&Some Menu Item",              IDM_SOMEMENUITEM
        END
    END
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C help for network animator
    By fastshadow in forum Tech Board
    Replies: 7
    Last Post: 03-17-2006, 03:44 AM
  2. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 11:50 AM
  3. Popup menu in tray wont disapear
    By SwiftOutlaw in forum Windows Programming
    Replies: 3
    Last Post: 01-18-2005, 06:00 PM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 04:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21