Modify

Opened 15 years ago

Closed 15 years ago

#1615 closed Bug (Fixed)

_GUICtrlTreeView_SetStateImageIndex() prohibits 0 in $iIndex parameter

Reported by: doudou Owned by: Jpm
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 follow-up: Changed 15 years ago by 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

comment:2 in reply to: ↑ 1 Changed 15 years ago by doudou

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 Changed 15 years ago by Jpm

Thanks a lot

comment:4 Changed 15 years ago by Jpm

  • Milestone set to 3.3.7.0
  • Owner changed from Gary to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [5813] in version: 3.3.7.0

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.