Custom Query

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (145 - 147 of 3856)

Ticket Resolution Summary Owner Reporter
#700 Fixed _GUICtrlTreeView_ClickItem() function does not always click on Tree View item Gary Bowmore
Description

Enviroment: Win XP Home SP3 AutoIt 3.2.12.1 AutoIt Beta 3.2.13.11

The coords of the centre of the item are calculated relative to the top left origin of the tree view control, but the click is preformed using whatever MouseCoordMode the user has set. The MouseCoordMode option needs setting to 1 and then resetting back to the original value before exiting the function. The coords of the item and the origin of the Tree View control need to be added to get the coords relative to the screen.

Code to demonstrate existing behaviour of existing function and that of the suggested fix below. GuiControlsItemClickTest.exe is a compiled version of the Sample GUI from the examples folder to give some tabs to click.

Opt("MustDeclareVars", 1)
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)

#include <GuiTreeView.au3>

Local $hWnd = 0 
Local $iCommandID = 0
Local $hItem = 0

Run(@ScriptDir & "\GuiControlsItemClickTest.exe")

For $ifunc = 0 To 1 
	;Display behaviour when mouse is not moved and then when mouse is moved
	For $iMove = 0 To 1
		;Use each of the MouseCoordMode in turn 
		For $iCoordMode = 0 To 2
			Opt("MouseCoordMode", $iCoordMode)
			WinActivate("Sample GUI")
			$hwnd = ControlGetHandle("Sample GUI","","SysTreeView322")
			If $ifunc = 0 Then
				;click on Tree View Item2 without moving mouse
				ToolTip("Standard UDF Function '_GUICtrlTreeView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'Item2' moving mouse " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				$hItem = _GUICtrlTreeView_FindItem($hWnd, "Item2") 
				_GUICtrlTreeView_EnsureVisible($hWnd, $hItem)
				WinActivate("Sample GUI")
				_GUICtrlTreeView_ClickItem($hWnd, $hItem, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
				;click on Tree View foo moving mouse
				ToolTip("Standard UDF Function '_GUICtrlTreeView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'TreeView' moving mouse " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				$hItem = _GUICtrlTreeView_FindItem($hWnd, "TreeView") 
				_GUICtrlTreeView_EnsureVisible($hWnd, $hItem)
				WinActivate("Sample GUI")
				_GUICtrlTreeView_ClickItem($hWnd, $hItem, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
			Else
				;click on Tree View Item1 without moving mouse
				ToolTip("Modified UDF Function '_GUICtrlTreeView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'Foo' moving mouse " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				$hItem = _GUICtrlTreeView_FindItem($hWnd, "Foo") 
				_GUICtrlTreeView_EnsureVisible($hWnd, $hItem)
				WinActivate("Sample GUI")
				MOD_GUICtrlTreeView_ClickItem($hWnd, $hItem, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
				;click on Tree View TreeView moving mouse
				ToolTip("Modified UDF Function '_GUICtrlTreeView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'Item1' moving mouse " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				$hItem = _GUICtrlTreeView_FindItem($hWnd, "Item1") 
				_GUICtrlTreeView_EnsureVisible($hWnd, $hItem)
				WinActivate("Sample GUI")
				MOD_GUICtrlTreeView_ClickItem($hWnd, $hItem, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
			EndIf
		Next
	Next
Next
Exit

Func MOD_GUICtrlTreeView_ClickItem($hWnd, $hItem, $sButton = "left", $fMove = False, $iClicks = 1, $iSpeed = 0)
	If $Debug_TV Then _GUICtrlTreeView_ValidateClassName($hWnd)
	If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
	Local $tPoint, $tRect, $iX, $iY, $iXOrigin, $iYOrigin, $iMode, $aPos

	;Get position of TreeView control
	$tRect = _WinAPI_GetWindowRect($hWnd)
	;Get coords of TreeView top left corner
	$tPoint = _WinAPI_PointFromRect($tRect, False)
	_WinAPI_GetXYFromPoint($tPoint, $iXOrigin, $iYOrigin)
	;Get centre if item relative to TreeView control
	$tRect = _GUICtrlTreeView_DisplayRectEx($hWnd, $hItem, True)
	$tPoint = _WinAPI_PointFromRect($tRect)
	_WinAPI_GetXYFromPoint($tPoint, $iX, $iY)
	; Add coords to get screen coords
	$iX += $iXOrigin
	$iY += $iYOrigin
	;Switch to screen MouseCoordMode 
	$iMode = Opt("MouseCoordMode", 1)
	If Not $fMove Then
		$aPos = MouseGetPos()
		_WinAPI_ShowCursor(False)
		;_WinAPI_ShowCursor does not seem to work on XP so set mouse speed it instant 
		MouseClick($sButton, $iX, $iY, $iClicks, 0)
		MouseMove($aPos[0], $aPos[1], 0)
		_WinAPI_ShowCursor(True)
	Else
		MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed)
	EndIf
	;Switch back to user MouseCoordMode 
	Opt("MouseCoordMode", $iMode)
EndFunc   ;==>_GUICtrlTreeView_ClickItem
#701 Fixed _GUICtrlListView_ClickItem() function does not always click on List View item Gary Bowmore
Description

The coords of the centre of the item are calculated in screen coords, but the click is preformed using whatever MouseCoordMode the user has set. The MouseCoordMode option needs setting to 1 and then resetting back to the original value before exiting the function.

"Code to demonstrate existing behaviour of existing function and that of the suggested fix below. GuiControlsItemClickTest.exe is a compiled version of the Sample GUI from the examples folder to give some tabs to click. GuiControlsItemClickTest.exe is the SampleControls.au3 from the AutoIt\Examples folder compliled and saved as GuiControlsItemClickTest.exe

Opt("MustDeclareVars", 1)
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)

#include <GuiListView.au3>

Local $hWnd = 0 
Local $iCommandID = 0

Run(@ScriptDir & "\GuiControlsItemClickTest.exe")

For $ifunc = 0 To 1 
	;Display behaviour when mouse is not moved and then when mouse is moved
	For $iMove = 0 To 1
		;Use each of the MouseCoordMode in turn 
		For $iCoordMode = 0 To 2
			Opt("MouseCoordMode", $iCoordMode)
			WinActivate("Sample GUI")
			$hwnd = ControlGetHandle("Sample GUI","","SysListView321")
			If $ifunc = 0 Then
				;click on List View Item 1 without moving mouse
				ToolTip("Standard UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'A    One' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				_GUICtrlListView_ClickItem($hWnd, 0, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
				;click on List View Item 2 moving mouse
				ToolTip("Standard UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'C    Three' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				_GUICtrlListView_ClickItem($hWnd, 2, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
			Else
				;click on List View Item 3 without moving mouse
				ToolTip("Modified UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'A    One' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				MOD_GUICtrlListView_ClickItem($hWnd, 0, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
				;click on List View Item 4 moving mouse
				ToolTip("Modified UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'B    Two' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				MOD_GUICtrlListView_ClickItem($hWnd, 1, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
			EndIf
		Next
	Next
Next
Exit

Func MOD_GUICtrlListView_ClickItem($hWnd, $iIndex, $sButton = "left", $fMove = False, $iClicks = 1, $iSpeed = 1)
	If $Debug_LV Then _GUICtrlListView_ValidateClassName($hWnd)
	If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
	Local $aPos, $tRect, $iX, $iY, $tPoint, $iMode

	_GUICtrlListView_EnsureVisible($hWnd, $iIndex, False)
	$tRect = _GUICtrlListView_GetItemRectEx($hWnd, $iIndex, $LVIR_LABEL)
	$tPoint = _WinAPI_PointFromRect($tRect, True)
	$tPoint = _WinAPI_ClientToScreen($hWnd, $tPoint)
	_WinAPI_GetXYFromPoint($tPoint, $iX, $iY)
	;Switch to screen MouseCoordMode 
	$iMode = Opt("MouseCoordMode", 1)
	If Not $fMove Then
		$aPos = MouseGetPos()
		_WinAPI_ShowCursor(False)
		;_WinAPI_ShowCursor does not seem to work on XP so set mouse speed it instant 
		MouseClick($sButton, $iX, $iY, $iClicks, 0)
		MouseMove($aPos[0], $aPos[1], 0)
		_WinAPI_ShowCursor(True)
	Else
		MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed)
	EndIf
	;Switch back to user MouseCoordMode 
	Opt("MouseCoordMode", $iMode)
EndFunc   ;==>_GUICtrlListView_ClickItem
#702 Duplicate _GUICtrlListView_ClickItem() function does not always click on List View item Gary Bowmore
Description

Enviroment: Win XP Home SP3 AutoIt 3.2.12.1 AutoIt Beta 3.2.13.11

The coords of the centre of the item are calculated in screen coords, but the click is preformed using whatever MouseCoordMode the user has set. The MouseCoordMode option needs setting to 1 and then resetting back to the original value before exiting the function.

"Code to demonstrate existing behaviour of existing function and that of the suggested fix below. GuiControlsItemClickTest.exe is a compiled version of the Sample GUI from the examples folder to give some tabs to click. GuiControlsItemClickTest.exe is the SampleControls.au3 from the AutoIt\Examples folder compliled and saved as GuiControlsItemClickTest.exe

Opt("MustDeclareVars", 1)
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)

#include <GuiListView.au3>

Local $hWnd = 0 
Local $iCommandID = 0

Run(@ScriptDir & "\GuiControlsItemClickTest.exe")

For $ifunc = 0 To 1 
	;Display behaviour when mouse is not moved and then when mouse is moved
	For $iMove = 0 To 1
		;Use each of the MouseCoordMode in turn 
		For $iCoordMode = 0 To 2
			Opt("MouseCoordMode", $iCoordMode)
			WinActivate("Sample GUI")
			$hwnd = ControlGetHandle("Sample GUI","","SysListView321")
			If $ifunc = 0 Then
				;click on List View Item 1 without moving mouse
				ToolTip("Standard UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'A    One' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				_GUICtrlListView_ClickItem($hWnd, 0, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
				;click on List View Item 2 moving mouse
				ToolTip("Standard UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'C    Three' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				_GUICtrlListView_ClickItem($hWnd, 2, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
			Else
				;click on List View Item 3 without moving mouse
				ToolTip("Modified UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'A    One' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				MOD_GUICtrlListView_ClickItem($hWnd, 0, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
				;click on List View Item 4 moving mouse
				ToolTip("Modified UDF Function '_GUICtrlListView_ClickItem()' MouseCoordMode = " & $iCoordMode & @CRLF & "Attempting To click on item 'B    Two' mouse moving is " & ($iMove <> 0), 20, 20)
				WinActivate("Sample GUI")
				MOD_GUICtrlListView_ClickItem($hWnd, 1, "left", ($iMove <> 0), 1, 50)
				Sleep(3000)
			EndIf
		Next
	Next
Next
Exit

Func MOD_GUICtrlListView_ClickItem($hWnd, $iIndex, $sButton = "left", $fMove = False, $iClicks = 1, $iSpeed = 1)
	If $Debug_LV Then _GUICtrlListView_ValidateClassName($hWnd)
	If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
	Local $aPos, $tRect, $iX, $iY, $tPoint, $iMode

	_GUICtrlListView_EnsureVisible($hWnd, $iIndex, False)
	$tRect = _GUICtrlListView_GetItemRectEx($hWnd, $iIndex, $LVIR_LABEL)
	$tPoint = _WinAPI_PointFromRect($tRect, True)
	$tPoint = _WinAPI_ClientToScreen($hWnd, $tPoint)
	_WinAPI_GetXYFromPoint($tPoint, $iX, $iY)
	;Switch to screen MouseCoordMode 
	$iMode = Opt("MouseCoordMode", 1)
	If Not $fMove Then
		$aPos = MouseGetPos()
		_WinAPI_ShowCursor(False)
		;_WinAPI_ShowCursor does not seem to work on XP so set mouse speed it instant 
		MouseClick($sButton, $iX, $iY, $iClicks, 0)
		MouseMove($aPos[0], $aPos[1], 0)
		_WinAPI_ShowCursor(True)
	Else
		MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed)
	EndIf
	;Switch back to user MouseCoordMode 
	Opt("MouseCoordMode", $iMode)
EndFunc   ;==>_GUICtrlListView_ClickItem
Note: See TracQuery for help on using queries.