PC Review


Reply
Thread Tools Rate Thread

Checking CheckBoxes of ListView at runtime

 
 
boble
Guest
Posts: n/a
 
      26th Aug 2003
I would like to change the CheckBoxes property of a list
view at runtime, but doing so does not show the checkboxes.
The text in the first column is aligned to the right side
and you have to click several times on an empty space (of
the column) in order to have the checkbox show up.

Anyone know a fix to this?

Thanx all!

PS: I use listView.Invalidate(true) when CheckBoxes
property is set to true.
 
Reply With Quote
 
 
 
 
Rick [MSFT]
Guest
Posts: n/a
 
      27th Aug 2003
Hi Bob,

Can you provide more detail on the following questions? I tried this a few
different ways and was not able to see the behavior you're describing.

1. What framework version are you using (1.0 or 1.1)?
2. What version of VS.NET are you using?
3. Besides changing the CheckBoxes property of the ListView, what other
properties were changed? Specifically, what is your View property set to?

What I did is created a default windows application and added a ListView
control to the form. Then, I added a couple of columns and made the first
column right justified. Next, I added some items using the ListViewItem
Collection Editor. Finally, I added a button that when clicked, simply
toggles the CheckBoxes property of the ListView. I tested this on version
1.1 of the framework using VS.NET 2003.

Thanks,
Rick [MSFT]

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
| I would like to change the CheckBoxes property of a list
| view at runtime, but doing so does not show the checkboxes.
| The text in the first column is aligned to the right side
| and you have to click several times on an empty space (of
| the column) in order to have the checkbox show up.
|
| Anyone know a fix to this?
|
| Thanx all!
|
| PS: I use listView.Invalidate(true) when CheckBoxes
| property is set to true.
|

 
Reply With Quote
 
boble
Guest
Posts: n/a
 
      3rd Sep 2003
Hello Rick:

thank you for your reply and sorry for my delay ...

I tried to create a small piece of code that would show
better what the problem was but couldnt do it.

It is very hard to pinpoint where the problem is cuz
several .NET classes have been derived from, such as:

- XItem class derives from ListViewItem;
- XList class derives from ListView;
- XYList class derives from XList; (borth XList and XYList
have two columns)


Now, I was trying to change the CheckBoxes property of
XYList at runtime and it the checkboxes would fail to
show. The items can be added/removed at runtime. The label
of the first column (where a checkbox were to show) would
be right-aligned and one would have to double-click on the
cell to have the checkbox show up.

The workaround? I found the following to work:

bool existing = listView.CheckBoxes;
listView.CheckBoxes = true;
listView.Items.Add(new XItem(cust-obj));
listView.CheckBoxes = existing;


Im using Visual Studio 7.1.3088, .NET Framework 1.1.4322
on Windows 2000 professional with Service Pack 4.

My View property is set to Details.

Thanx,

>-----Original Message-----
>Hi Bob,
>
>Can you provide more detail on the following questions?

I tried this a few
>different ways and was not able to see the behavior

you're describing.
>
>1. What framework version are you using (1.0 or 1.1)?
>2. What version of VS.NET are you using?
>3. Besides changing the CheckBoxes property of the

ListView, what other
>properties were changed? Specifically, what is your View

property set to?
>
>What I did is created a default windows application and

added a ListView
>control to the form. Then, I added a couple of columns

and made the first
>column right justified. Next, I added some items using

the ListViewItem
>Collection Editor. Finally, I added a button that when

clicked, simply
>toggles the CheckBoxes property of the ListView. I

tested this on version
>1.1 of the framework using VS.NET 2003.
>
>Thanks,
>Rick [MSFT]
>
>This posting is provided "AS IS", with no warranties, and

confers no rights.
>
>--------------------
>| I would like to change the CheckBoxes property of a

list
>| view at runtime, but doing so does not show the

checkboxes.
>| The text in the first column is aligned to the right

side
>| and you have to click several times on an empty space

(of
>| the column) in order to have the checkbox show up.
>|
>| Anyone know a fix to this?
>|
>| Thanx all!
>|
>| PS: I use listView.Invalidate(true) when CheckBoxes
>| property is set to true.
>|
>
>.
>

 
Reply With Quote
 
Rick [MSFT]
Guest
Posts: n/a
 
      5th Sep 2003
Hi Bob,

The code you listed as a "work-around" for you is exactly the same thing I
was doing before. I also confirmed that we're running the same version.
I'm glad you found a way to solve your problem, but I'm concerned that
there is an issue that remains unsolved.

One thing I noticed is that the first column of the listview is always left
aligned. You indicated before that your first column was right aligned.
This conflicts with the sample I tried. I can align second and subsequent
columns to center or right, but the first column is always left aligned. I
tried adjusting the alignment of the first column at runtime also, but it
just ignores the alignment. So, I'm not clear on how you were aligning the
first column to the right. Do you have the code that was faulting before?
If so, what is different about it than what you have listed as code that
works for you?

Either way, I tried a few more scenarios and was not able to observe the
behavior.

Thanks,
Rick [MSFT]

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
| Hello Rick:
|
| thank you for your reply and sorry for my delay ...
|
| I tried to create a small piece of code that would show
| better what the problem was but couldnt do it.
|
| It is very hard to pinpoint where the problem is cuz
| several .NET classes have been derived from, such as:
|
| - XItem class derives from ListViewItem;
| - XList class derives from ListView;
| - XYList class derives from XList; (borth XList and XYList
| have two columns)
|
|
| Now, I was trying to change the CheckBoxes property of
| XYList at runtime and it the checkboxes would fail to
| show. The items can be added/removed at runtime. The label
| of the first column (where a checkbox were to show) would
| be right-aligned and one would have to double-click on the
| cell to have the checkbox show up.
|
| The workaround? I found the following to work:
|
| bool existing = listView.CheckBoxes;
| listView.CheckBoxes = true;
| listView.Items.Add(new XItem(cust-obj));
| listView.CheckBoxes = existing;
|
|
| Im using Visual Studio 7.1.3088, .NET Framework 1.1.4322
| on Windows 2000 professional with Service Pack 4.
|
| My View property is set to Details.
|
| Thanx,
|
| >-----Original Message-----
| >Hi Bob,
| >
| >Can you provide more detail on the following questions?
| I tried this a few
| >different ways and was not able to see the behavior
| you're describing.
| >
| >1. What framework version are you using (1.0 or 1.1)?
| >2. What version of VS.NET are you using?
| >3. Besides changing the CheckBoxes property of the
| ListView, what other
| >properties were changed? Specifically, what is your View
| property set to?
| >
| >What I did is created a default windows application and
| added a ListView
| >control to the form. Then, I added a couple of columns
| and made the first
| >column right justified. Next, I added some items using
| the ListViewItem
| >Collection Editor. Finally, I added a button that when
| clicked, simply
| >toggles the CheckBoxes property of the ListView. I
| tested this on version
| >1.1 of the framework using VS.NET 2003.
| >
| >Thanks,
| >Rick [MSFT]
| >
| >This posting is provided "AS IS", with no warranties, and
| confers no rights.
| >
| >--------------------
| >| I would like to change the CheckBoxes property of a
| list
| >| view at runtime, but doing so does not show the
| checkboxes.
| >| The text in the first column is aligned to the right
| side
| >| and you have to click several times on an empty space
| (of
| >| the column) in order to have the checkbox show up.
| >|
| >| Anyone know a fix to this?
| >|
| >| Thanx all!
| >|
| >| PS: I use listView.Invalidate(true) when CheckBoxes
| >| property is set to true.
| >|
| >
| >.
| >
|

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listview with checkboxes [2.0] Jon Microsoft Dot NET Framework Forms 1 19th Jan 2007 04:16 PM
ListView with checkboxes Xarky Microsoft C# .NET 0 25th Feb 2005 01:39 PM
listview and checkboxes Piotrek Stachowicz Microsoft C# .NET 1 6th Aug 2004 03:52 PM
ListView with Checkboxes Mike Microsoft C# .NET 1 29th May 2004 04:18 AM
Listview checkboxes Dean Bortell Microsoft Dot NET 1 22nd Aug 2003 05:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:15 PM.