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. Dynamic Change Between Single/Multi select i CListCtrl

Dynamic Change Between Single/Multi select i CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 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.
  • M Offline
    M Offline
    Michael Olsen
    wrote on last edited by
    #1

    Hello all, I have a problem with my app. i have a CListCtrl where i need to change between Multiple selected and single selected with a check box. I have been looking through the articles but didnt find anything. Can anyone help me please? In advance thanks, Michael Olsen

    N L 2 Replies Last reply
    0
    • M Michael Olsen

      Hello all, I have a problem with my app. i have a CListCtrl where i need to change between Multiple selected and single selected with a check box. I have been looking through the articles but didnt find anything. Can anyone help me please? In advance thanks, Michael Olsen

      N Offline
      N Offline
      Navin
      wrote on last edited by
      #2

      I am assuming the CListCtrl is similar in this regard to the CListBox. If anyone knows of a good way to do this with CListCtrl, I want to know too. But I do know you can't do it with a listbox. The Windows designers apparently never figured that someone might want to switch between single select and multiple select at run-time... So your options are as follows: :bob: Create *two* list controls, right on top of each other, one is a Multiselect, the other is a Single select. Show only the one you want at any given time. Whenever you change between Single and Multiple select, show the appropriate list, and synchronize the contents. The disadvantage is that functions that do something to the list control have to be smart enough to know which one to use... or you have to make a wrapper class around the list controls to handle it. :bob: Create a custom control, or derive a new control from CListCtrl and do the rest of the functionality manually. Then post it on CP as an article. :-D You can pick your friends, and you can pick your nose, but you can't pick your friend's nose.

      1 Reply Last reply
      0
      • M Michael Olsen

        Hello all, I have a problem with my app. i have a CListCtrl where i need to change between Multiple selected and single selected with a check box. I have been looking through the articles but didnt find anything. Can anyone help me please? In advance thanks, Michael Olsen

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Try this, but I haven't tested it:

        ModifyStyle(0, LVS_SINGLESEL); // disable multiple selections
        ModifyStyle(LVS_SINGLESEL, 0); // enable multiple selections

        regards

        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