Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ListBox

ListBox

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AbhiHcl
    wrote on last edited by
    #1

    How to add check mark in front of selected item in listbox in MFC.. Can anyone help me how to do this.. Thanks..

    M 1 Reply Last reply
    0
    • A AbhiHcl

      How to add check mark in front of selected item in listbox in MFC.. Can anyone help me how to do this.. Thanks..

      M Offline
      M Offline
      MsmVc
      wrote on last edited by
      #2

      use

      CCheckListBox

      . I hope it will help you.

      A 1 Reply Last reply
      0
      • M MsmVc

        use

        CCheckListBox

        . I hope it will help you.

        A Offline
        A Offline
        AbhiHcl
        wrote on last edited by
        #3

        No sir, CCheckListbox will show the check box in front of every item, but I want to put check mark only in the front of selected item, rest of the items shoud not hv check box.

        N 1 Reply Last reply
        0
        • A AbhiHcl

          No sir, CCheckListbox will show the check box in front of every item, but I want to put check mark only in the front of selected item, rest of the items shoud not hv check box.

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          If it's your owner drawn list box with the hover effect, you can just paint the check mark in your DrawItem() method. Otherwise I'm afraid you will have to create yet another owner drawn list box class.

          home

          A 1 Reply Last reply
          0
          • N Niklas L

            If it's your owner drawn list box with the hover effect, you can just paint the check mark in your DrawItem() method. Otherwise I'm afraid you will have to create yet another owner drawn list box class.

            home

            A Offline
            A Offline
            AbhiHcl
            wrote on last edited by
            #5

            ya its my ownerdraw list box.. but I don't know how t oremove rest of check boxes on paint. Could u please send me some sample code or some more hnt how to do.. Thanks..

            N 1 Reply Last reply
            0
            • A AbhiHcl

              ya its my ownerdraw list box.. but I don't know how t oremove rest of check boxes on paint. Could u please send me some sample code or some more hnt how to do.. Thanks..

              N Offline
              N Offline
              Niklas L
              wrote on last edited by
              #6

              I would probably try to derive my class from a non-checkbox control to avoid all checkboxes in the first place. Then, paint a check box and maintain the checked state myself. Are you going to use the checkbox as a selection indicator only, or does it have any other purpose?

              home

              A 1 Reply Last reply
              0
              • N Niklas L

                I would probably try to derive my class from a non-checkbox control to avoid all checkboxes in the first place. Then, paint a check box and maintain the checked state myself. Are you going to use the checkbox as a selection indicator only, or does it have any other purpose?

                home

                A Offline
                A Offline
                AbhiHcl
                wrote on last edited by
                #7

                it doesn't hv any purpose. the only thing is that it make difference between the item which is already selected and the item which have the focus. I mean If "A" is already selected and my mouse is on "B" then "A" shoud hv check mark and "B " hv background color in back.

                N 1 Reply Last reply
                0
                • A AbhiHcl

                  it doesn't hv any purpose. the only thing is that it make difference between the item which is already selected and the item which have the focus. I mean If "A" is already selected and my mouse is on "B" then "A" shoud hv check mark and "B " hv background color in back.

                  N Offline
                  N Offline
                  Niklas L
                  wrote on last edited by
                  #8

                  Well, then just paint a check mark (or whatever icon you'd like) in the beginning of the row if the item is selected. Edit: Another way of dealing with this is to use the font and change it to be underlined when hovered. That way the selection problem goes away.

                  home

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups