RSS Forums RSS
Please support our VB.NET advertiser: Programming Forums
Views: 5119 | Replies: 6 | Thread Tools  Display Modes
Reply
Join Date: Oct 2007
Posts: 13
Reputation: Cecilia_notes is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Cecilia_notes Cecilia_notes is offline Offline
Newbie Poster

How to overcoming a .NET ListView CheckBoxes quirk

  #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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 4,844
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 325
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

  #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  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,167
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

  #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  
Join Date: Oct 2007
Posts: 13
Reputation: Cecilia_notes is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Cecilia_notes Cecilia_notes is offline Offline
Newbie Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

  #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  
Join Date: Oct 2007
Posts: 13
Reputation: Cecilia_notes is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Cecilia_notes Cecilia_notes is offline Offline
Newbie Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

  #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  
Join Date: Aug 2005
Posts: 4,844
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 325
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

  #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  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,167
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: How to overcoming a .NET ListView CheckBoxes quirk

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:53 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC