Multiple select listview with checkbox's

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Rodent
Posts: 40
Last visit: Tue Mar 01, 2022 3:39 pm

Multiple select listview with checkbox's

Post by Rodent »

Hi,

I'm creating a list of information in a listview control that has checkboxes set to true and muliselect set to true.

when I highlight say 3 items the control is only checking two items as seen in the attachment.

Is this something that you can fix, is it by design or is it a Microsoft problem....


Regards
Rodney
Attachments
Form.png
Form.png (25.07 KiB) Viewed 6733 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multiple select listview with checkbox's

Post by jvierra »

Check and select are not the same thing. You need a full click to check.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multiple select listview with checkbox's

Post by jvierra »

Select all items by shift select or click select and click any checkbox and all will be checked. Thisis pretty much the default behavior of all forms that use a checked listview.
User avatar
Rodent
Posts: 40
Last visit: Tue Mar 01, 2022 3:39 pm

Re: Multiple select listview with checkbox's

Post by Rodent »

jvierra wrote:Check and select are not the same thing. You need a full click to check.
When I select multiple items they are being checked automatically, so when I select the first item and then shift select the third item the first two are being checked automatically (as attachment shows), I then have to check the third item manually by clicking on the checkbox of the third item (I should not have to do this), subsequence clicking of checkbox will check or uncheck all highlighted items.

When I write the same code in VS.net selecting multiple items does not check the checkboxes but clicking on one of the selected checkboxes they are all checked or unchecked. This is the proper behavior of a listview object.

regards
Rodney
User avatar
Rodent
Posts: 40
Last visit: Tue Mar 01, 2022 3:39 pm

Re: Multiple select listview with checkbox's

Post by Rodent »

The same goes with control clicking, I select the first item I would like to check then hold control down and select the second item I would like to check but only the first item is checked.
All subsequence selecting is the same the previously selected item is checked and not the item currently being selected so once I have finished highlighting all the items I want I still have to check the last item by clicking on its checkbox.

This is not the correct behavior.

Regards
Rodney
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multiple select listview with checkbox's

Post by jvierra »

VS - PowerShell. Doesn't matter. Windows handles the behavior. It is the same control everywhere.

By default selecting a row in a listview does NOT check the box. You need to click on the checkbox to check it.
User avatar
Rodent
Posts: 40
Last visit: Tue Mar 01, 2022 3:39 pm

Re: Multiple select listview with checkbox's

Post by Rodent »

jvierra wrote:VS - PowerShell. Doesn't matter. Windows handles the behavior. It is the same control everywhere.

By default selecting a row in a listview does NOT check the box. You need to click on the checkbox to check it.
That is not the behavior that I am experiencing! When I select more then one item the checkbox is being automatically checked.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multiple select listview with checkbox's

Post by jvierra »

Not for me. What have you changed in options and what code is altering the checkbox.

Download the sample and run it . It behaves correctly.
User avatar
Rodent
Posts: 40
Last visit: Tue Mar 01, 2022 3:39 pm

Re: Multiple select listview with checkbox's

Post by Rodent »

jvierra wrote:Not for me. What have you changed in options and what code is altering the checkbox.

Download the sample and run it . It behaves correctly.
OK I have found that you need multiple columns and FullRowSelect = true

Regards
Rodney
User avatar
Rodent
Posts: 40
Last visit: Tue Mar 01, 2022 3:39 pm

Re: Multiple select listview with checkbox's

Post by Rodent »

And yes I have found that VS works the same.

So I'll go with this is a Microsoft bug.
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked