Addendum
Okay,
So, on my own, i decide, when you want something done right you do it yourself. It has solved all of these idiotic language barrier issues in the past, such as the sort-by-column issue with the ListView class. (where there is a column click, but the ListView won't sort by column, i'll never know).
However, my issue, is having CheckBox States for each item, but not Image Icon associated to the item, while having image icons associated to the ColumnHeaders. My Solution: Handle the Item State Changing myself, and incorporate the "CheckBox" images into the SmallImagelist, and basing the ImageIndex off of the ListViewItem.Checked property. Here is my code:
Sub ListViewItemCheck(ByVal sender As Object, ByVal e As ItemCheckEventArgs)
Dim i As ListViewItem = TaskListView.Items(e.Index)
Debug.Print("Checking({0}): {1}", i.Name, i.Checked)
Debug.Print("Value: {0},{1}", e.NewValue, e.CurrentValue)
End Sub
Sub ListViewItemChecked(ByVal sender As Object, ByVal e As ItemCheckedEventArgs)
e.Item.ImageIndex = Math.Abs(CInt(e.Item.Checked))
Debug.Print("Checked({0}): {1}", e.Item.Name, e.Item.Checked)
End Sub
Sub ListViewItemSelect(ByVal sender As Object, ByVal e As ListViewItemSelectionChangedEventArgs)
If e.IsSelected then 'AndAlso (f_ClickLocation.X <= 20) AndAlso (f_ClickLocation.X >= 4) Then
Debug.Print("Select({0}): {1}", e.Item.Name, e.Item.Checked)
End If
End Sub
Sub ListViewMouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim lv As ListView = sender
Dim Idx As Integer = (e.Location.Y \ 17) - 1
Dim i As ListViewItem = lv.Items(Idx)
If (e.Location.X >= 4) AndAlso (e.Location.x <= 20) AndAlso (Idx > -1) AndAlso (Idx < lv.Items.Count) Then
i.Checked = Not i.Checked
End If
Debug.Print("Click({0}): {1}", i.Name, i.Checked)
End Sub
Seems pretty straight forward. When an Item is clicked and the mouse pointer location is within the right range, it toggles the ListViewItem.Checked property. Which, according to LOGIC, would trigger the ItemCheck() event and subsequently the ItemChecked() event which sets the ListViewItem.ImageIndex. If you notice all the Debug.Print() statements, you'll see I recorded the event trigger order to help find out the issues.
these are the results of my test. Each Click event was within the correct range for the item to be Checked, not just selected. (I've provide comments for each one to show the program flow)
Select(HFHS0035_2008012_Pull): False
Click(HFHS0035_2008012_Pull): True
Checking(HFHS0035_2008012_Pull): True
Value: Unchecked,Checked //Checked was set to True, so why is the NEWVALUE False???
Checked(HFHS0035_2008012_Pull): False <- I clicked it only once, so this should be true!!!
//I can't even begin to explain why these events fired twice
Checking(HFHS0035_2008012_Pull): False
Value: Checked,Unchecked
Checked(HFHS0035_2008012_Pull): True
Click(HFHS0035_2008012_Pull): True
Select(BHG0032_2007124_Pull): False
Click(BHG0032_2007124_Pull): True
Checking(BHG0032_2007124_Pull): True
Value: Unchecked,Checked <- Again I set Checked to True, and here it is false
Checked(BHG0032_2007124_Pull): False
Select(SPMH9800_2008012_Pull): False
Click(SPMH9800_2008012_Pull): True <Where is the Checking/Checked events?
Select(BHG0032_2007124_Pull): False
Checking(BHG0032_2007124_Pull): False
Value: Checked,Unchecked <Checked is set to False, but here it is true
Checked(BHG0032_2007124_Pull): True
Click(BHG0032_2007124_Pull): True
Select(WEL0003_2008012_Pull): False
Click(WEL0003_2008012_Pull): True
Checking(WEL0003_2008012_Pull): True
Value: Unchecked,Checked <Again, I think the component is a little confused
Checked(WEL0003_2008012_Pull): False
Click(WEL0003_2008012_Pull): False <- why is there a secondary click event after
Select(GHS0050_2008013_Pull): False
Click(GHS0050_2008013_Pull): True
Select(GHS0064_2008012_Pull): False
Click(GHS0064_2008012_Pull): True
Select(UHS9800_2008012_Pull): False
Click(UHS9800_2008012_Pull): True
//The above i clicked in sequence, and you can see I've set the Checked property to true, for each one, and none of them triggered a Checking/Checked event
//I came back to check one already checked, and suddenly the checking/checked events trigger, but the trigger backwards.
Select(GHS0050_2008013_Pull): True
Checking(GHS0050_2008013_Pull): True
Value: Unchecked,Checked
Checked(GHS0050_2008013_Pull): False
Click(GHS0050_2008013_Pull): False
So you can see the assumed order of operation would be:
MouseDown
MouseClick
Select
ItemCheck
ItemChecked
MouseUp
As it appears, I'm something more like this:
MouseDown
Select
MouseClick
And Only when I click a second time in a Item whose Checked Property has been set again, then I get
MouseDown
Select
ItemCheck
ItemChecked
Click()
Well the ItemCheck is happening before the Click() so it is reading the current value as True, and toggling it, and then the click() even happens afterwards and re-toggles the value. The handling of events here is PATHETIC. I write my own code all the time and my events always fire in the sequence they are given, and they fire EVERYTIME. VB.NET is written by the supposed "masters" of language, and their events aren't even reliable that they'll fire. The Checking/Checked events should fire EVERYTIME the Checked property is changed. Not when the ListView feels, on a whim, that okay, i'll fire the event now.
How can this language into doing what it is SUPPOSED to do.
Disgruntled,
Jaeden "Sifo Dyas" al'Raec Ruiner