How to overcoming a .NET ListView CheckBoxes quirk

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 13
Reputation: Cecilia_notes is an unknown quantity at this point 
Solved Threads: 0
Cecilia_notes Cecilia_notes is offline Offline
Newbie Poster

How to overcoming a .NET ListView CheckBoxes quirk

 
0
  #1
Oct 29th, 2007
I have a ListView showing all the words from a file, the code is checking these words all the time to see whether they meet certain condition, or so, I would like the checkbox of that list item checked. I have 2 problems here:

1. How can I prevent the user from checking or unckecking the checkboxes? The checkboxes should be only checked/unchecked by the code.

2. When the user double click any list item, it popup an dialog, but the .NET ListView component automatically toggles the checked state of items when you double click on them. How can I keep the ListView checkboxes status as it is when I double click the item?

Any suggestion is appreciated!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: How to overcoming a .NET ListView CheckBoxes quirk

 
0
  #2
Oct 29th, 2007
set it t false or something
Last edited by iamthwee; Oct 29th, 2007 at 3:53 pm.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

 
0
  #3
Oct 29th, 2007
I would use two images. One of a checked checkbox and one of an unchecked checkbox. Swap the images in your code according to your logic. Clicks will no longer be a problem and the user cannot check/uncheck boxes.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Cecilia_notes is an unknown quantity at this point 
Solved Threads: 0
Cecilia_notes Cecilia_notes is offline Offline
Newbie Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

 
0
  #4
Oct 29th, 2007
I tried similar way, instead of swapping images, I changed the item's backcolor, there is problem too. For example, one list item meets the condition, so its backcolor is set to certain color by code, but when I double click the item, the backcolor changes to a gray color you see when list item is selected, and it stays in that color until you click on another list item, then the color changes back to the color the code set.

The idea of swapping 2 images might work, but I need to find 2 images small enough to be put beside list items, and I have no idea how to put an image beside and listview item. I will go check it out.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Cecilia_notes is an unknown quantity at this point 
Solved Threads: 0
Cecilia_notes Cecilia_notes is offline Offline
Newbie Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

 
0
  #5
Oct 29th, 2007
Currently, I set all the items that fit the condition to selected by setting the item's Selected property to true, and my listview enables multiselect. The problem is when the use single click or double click any item, the newly selected item becomes the only one that is selected, how can I keep all the other selected items highlighted as well as the newly selected one or ones?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: How to overcoming a .NET ListView CheckBoxes quirk

 
0
  #6
Oct 29th, 2007
Show us your code and possibly a screenshot of your app so far.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

 
0
  #7
Oct 30th, 2007
Cecilia,

In woodcraft they teach you to go with the grain, otherwise the planer or chisel makes a ragged mess. It's similar in programming. Currently you are fighting against the grain and having a hard time of it.

Try to give us an idea of what you are trying to acheive. By that I mean: What is the purpose of this list view? I am struggling to think of a reason a user would multi select items (CTRL + LEFT CLICK) and then want to double click one to do? ...what?

I can't think of any software I've used that requires me to interact in this manner. It sounds like a battle! The code is selecting items using checkboxes, the user is selecting by clicking. And what is a listview anyway? some 3rd party control? or is it a standard ASP.NET Listbox? if so no you can't bind images to a listbox use a DataList or a GridView they support template columns in which you can include an image control.
Last edited by hollystyles; Oct 30th, 2007 at 5:25 am.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC