Modify

Opened 15 years ago

Closed 14 years ago

#1296 closed Bug (Fixed)

_GUICtrlTreeView_ClickItem fails with item text wider than TreeView

Reported by: ResNullius Owned by: Valik
Milestone: 3.3.1.6 Component: Standard UDFs
Version: 3.3.1.5 Severity: Blocking
Keywords: Cc:

Description

If a TreeView or Gui containing a TreeView is not wide enough to show the full text of a TreeView item, _GUICtrlTreeView_ClickItem will click outside of the treeview or parent window.

Fails with both production 3.3.0.0 and beta 3.3.1.5 on XP Pro 32bit w/ SP3

Modified example from help file to demonstrate:

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hTreeView

_Main()

Func _Main()

	Local $hItem[6], $hImage, $iImage, $gui, $sDesc
	Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

	$gui = GUICreate("TreeView Click Item", 400, 300)

	$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
	GUISetState()

	$hImage = _GUIImageList_Create(16, 16, 5, 3)
	_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
	_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
	_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
	_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
	_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
	_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
	_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

	_GUICtrlTreeView_BeginUpdate($hTreeView)

  $sDesc = "A long Description"
  For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
    $hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item with " & $sDesc, $x + 1), $x, $x)
		$sDesc &= " " & $sDesc
  Next

	_GUICtrlTreeView_EndUpdate($hTreeView)

For $x = 0 To UBound($hItem) - 1
    If Not WinActive($gui) then
			MsgBox(4096,"OOPS","I'd be clicking outside of the treeview's window")
		Else
			_GUICtrlTreeView_ClickItem($hTreeView, $hItem[$x],"left", True)
		EndIf
		ConsoleWrite("Item: " & $x & @TAB & "Active Win = " & WinGetTitle("[ACTIVE]") & @CRLF)
    Sleep(500)
Next

WinActivate($gui)
; Loop until user exits
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
	GUIDelete()
EndFunc   ;==>_Main

Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by Valik

  • Severity changed from None to Blocking

comment:2 Changed 14 years ago by Valik

  • Milestone set to 3.3.1.6
  • Owner changed from Gary to Valik
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [5416] in version: 3.3.1.6

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 Valik.
Author


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

 
Note: See TracTickets for help on using tickets.