Modify

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)

comment:1 by J-Paul Mesnage, 16 years ago

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

in reply to:  1 comment:2 by doudou, 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:3 by J-Paul Mesnage, 16 years ago

Thanks a lot

comment:4 by J-Paul Mesnage, 16 years ago

Milestone: 3.3.7.0
Owner: changed from Gary to J-Paul Mesnage
Resolution: Fixed
Status: newclosed

Fixed by revision [5813] in version: 3.3.7.0

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.