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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. How to prevent user click to the checkbox on a listview control

How to prevent user click to the checkbox on a listview control

Scheduled Pinned Locked Moved .NET (Core and Framework)
helptutorial
6 Posts 4 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.
  • N Offline
    N Offline
    N Q H
    wrote on last edited by
    #1

    Hi all How to prevent user check on checkbox of a listview control. The listview control contains many of row items which can be selected by clicking on the checkbox. But now I want to prevent user click on the checkbox. I will check them by code in program. And the listview control will be still active. That means user still selects one row item but just cannot click on the checkbox. Anybody help me thanks in advanced!

    [N][Q][H]

    M L V 3 Replies Last reply
    0
    • N N Q H

      Hi all How to prevent user check on checkbox of a listview control. The listview control contains many of row items which can be selected by clicking on the checkbox. But now I want to prevent user click on the checkbox. I will check them by code in program. And the listview control will be still active. That means user still selects one row item but just cannot click on the checkbox. Anybody help me thanks in advanced!

      [N][Q][H]

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Assuming this is Forms... Maybe you could handle the ListView.ItemCheck event, and in your handler check if the ItemCheckEventArgs.NewValue is different from the ItemCheckEventArgs.CurrentValue, and if so, set the ItemCheckEventArgs.NewValue to ItemCheckEventArgs.CurrentValue.

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      1 Reply Last reply
      0
      • N N Q H

        Hi all How to prevent user check on checkbox of a listview control. The listview control contains many of row items which can be selected by clicking on the checkbox. But now I want to prevent user click on the checkbox. I will check them by code in program. And the listview control will be still active. That means user still selects one row item but just cannot click on the checkbox. Anybody help me thanks in advanced!

        [N][Q][H]

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

        [N][Q][H] wrote:

        But now I want to prevent user click on the checkbox.

        Why would you offer the user a checkbox if you don't want them to be able to use it?

        N 1 Reply Last reply
        0
        • L Lost User

          [N][Q][H] wrote:

          But now I want to prevent user click on the checkbox.

          Why would you offer the user a checkbox if you don't want them to be able to use it?

          N Offline
          N Offline
          N Q H
          wrote on last edited by
          #4

          Actually, I am trying to send message to a listview which does not allow me click to the checkbox. This is a trainning for a online game. Since character'level less than 10 I can click on the checkbox and this trainning will train my character. but if character'level greater than 10. The trainner will not allow me click to the checkbox. In the first case(level < 10). I have tried send message to click the first row items. It works properly.

          ListView_SetCheckState(hwnd,0,true);

          But when my character'level reachs to 11. The list view seems be blocked(Notice that listview still be actived). In this case, the code does not work. I cannot only click to the checkbox but also using ListView_SetCheckState. I guest that I need to send a message to update the property of listview before I can use ListView_SetCheckState. But what needs to be updated? Plz help me! thanks

          [N][Q][H]

          L 1 Reply Last reply
          0
          • N N Q H

            Actually, I am trying to send message to a listview which does not allow me click to the checkbox. This is a trainning for a online game. Since character'level less than 10 I can click on the checkbox and this trainning will train my character. but if character'level greater than 10. The trainner will not allow me click to the checkbox. In the first case(level < 10). I have tried send message to click the first row items. It works properly.

            ListView_SetCheckState(hwnd,0,true);

            But when my character'level reachs to 11. The list view seems be blocked(Notice that listview still be actived). In this case, the code does not work. I cannot only click to the checkbox but also using ListView_SetCheckState. I guest that I need to send a message to update the property of listview before I can use ListView_SetCheckState. But what needs to be updated? Plz help me! thanks

            [N][Q][H]

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

            [N][Q][H] wrote:

            But when my character'level reachs to 11. The list view seems be blocked(Notice that listview still be actived).

            I'm not sure what you are saying here; can you explain how this affects the ListView? Can you also show us the code that is affected?

            1 Reply Last reply
            0
            • N N Q H

              Hi all How to prevent user check on checkbox of a listview control. The listview control contains many of row items which can be selected by clicking on the checkbox. But now I want to prevent user click on the checkbox. I will check them by code in program. And the listview control will be still active. That means user still selects one row item but just cannot click on the checkbox. Anybody help me thanks in advanced!

              [N][Q][H]

              V Offline
              V Offline
              vsaratkar
              wrote on last edited by
              #6

              how about e.Handled = true in eventHandler, or disabling the check box. HTH,

              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