Opened 16 years ago
Closed 16 years ago
#1615 closed Bug (Fixed)
_GUICtrlTreeView_SetStateImageIndex() prohibits 0 in $iIndex parameter
| Reported by: | doudou | Owned by: | J-Paul Mesnage |
|---|---|---|---|
| Milestone: | 3.3.7.0 | Component: | Standard UDFs |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | gui, treeview | Cc: |
Description
If _GUICtrlTreeView_SetStateImageIndex() encounters 0 in $iIndex parameter it raises an error and refuses processing:
If $iIndex = 0 Then
; Invalid index for State Image" & @LF & "State Image List is One-based list
Return SetError(1, 0, False)
EndIf
This behavior is incorrect - 0 is perfectly valid and has the effect of hiding checkbox on a specific item as MSDN states.
Attachments (0)
Change History (4)
follow-up: 2 comment:1 by , 16 years ago
comment:2 by , 16 years ago
Replying to Jpm:
in fact 0, if I understand well, will reset the state.
something a little in contracdiction with the function name.
But if it can be really useful, I can change it just give me an example of it
I am working right now on a script where I use this effect but I'm afraid it's to large to serve as example. Briefly, there's a TreeView on the form with TVS_CHECKBOXES set but the user should only be able to see and set checks on the first 2 levels of the tree. The only way to achieve it is to send TVM_SETITEM with 0 in bits 12 - 15 of TVITEM.state for items, where no checkboxes are allowed. Extremely simplified the code looks like (_GUICtrlTreeView_SetStateImageIndex() was patched here):
$frmMain_tvwLib = GUICtrlCreateTreeView(8, 8, 249, 457, BitOR($GUI_SS_DEFAULT_TREEVIEW,$WS_CLIPSIBLINGS,$TVS_CHECKBOXES), $WS_EX_STATICEDGE)
$tviRoot = GUICtrlCreateTreeViewItem("Root with chekcbox", $frmMain_tvwLib)
$tviParent = GUICtrlCreateTreeViewItem("Parent with chekcbox", $tviRoot)
$tvi = GUICtrlCreateTreeViewItem("Child with no chekcbox", $tviParent)
_GUICtrlTreeView_SetStateImageIndex($frmMain_tvwLib, GUICtrlGetHandle($tvi), 0)
comment:4 by , 16 years ago
| Milestone: | → 3.3.7.0 |
|---|---|
| Owner: | changed from to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [5813] in version: 3.3.7.0

in fact 0, if I understand well, will reset the state.
something a little in contracdiction with the function name.
But if it can be really useful, I can change it just give me an example of it