If ib_stateclick Then
ll_rc = this.Of_SelectItem(handle, NOT this.Of_IsSelected(handle))
End If
Return ll_rc
其中Of_SelectItem是这样写的:
TreeViewItem ltvi_node
Integer li_rc
Long ll_handle
If al_handle > 0 Then
this.GetItem(al_handle, ltvi_node)
If ab_switch Then
Choose Case ltvi_node.StatePictureIndex
Case 1
ltvi_node.StatePictureIndex = 2 // Check Box
this.SetItem(al_handle, ltvi_node)
li_rc = 1
Case 3
ltvi_node.StatePictureIndex = 4 // Check Radio
this.SetItem(al_handle, ltvi_node)
// Uncheck all sibling radio buttons.
ll_handle = al_handle
Do While ll_handle <> -1
ll_handle = this.FindItem(PreviousTreeItem!, ll_handle)
If ll_handle > 0 Then
this.GetItem(ll_handle, ltvi_node)
If ltvi_node.StatePictureIndex = 4 Then
ltvi_node.StatePictureIndex = 3
this.SetItem(ll_handle, ltvi_node)
End If
End If
Loop
ll_handle = al_handle
Do While ll_handle <> -1
ll_handle = this.FindItem(NextTreeItem!, ll_handle)
If ll_handle > 0 Then
this.GetItem(ll_handle, ltvi_node)
If ltvi_node.StatePictureIndex = 4 Then
ltvi_node.StatePictureIndex = 3
this.SetItem(ll_handle, ltvi_node)
End If
End If
Loop
li_rc = 1
End Choose
Else
Choose Case ltvi_node.StatePictureIndex
Case 2
ltvi_node.StatePictureIndex = 1 // Uncheck Box
this.SetItem(al_handle, ltvi_node)
li_rc = 1
Case 4
// Cannot uncheck radio -- Only through checking another item.
li_rc = 0
End CHoose
End If
End If