Modify

Opened 11 years ago

Closed 11 years ago

#665 closed Bug (No Bug)

_GUICtrlListView_SetColumnWidth et al. lack proper typecasting in GUICtrlSendMsg

Reported by: sys55@… Owned by:
Milestone: Component: AutoIt
Version: 3.2.12.1 Severity: None
Keywords: Cc:

Description

Bug: _GUICtrlListView_SetColumnWidth et al. lack proper typecasting in GUICtrlSendMsg

Description: the $iWidth parameter in _GUICtrlListView_SetColumnWidth($hWnd, $iCol, $iWidth) causes the UDF to run havock when $iWidth is a numeric string. E.g.:
_GUICtrlListView_SetColumnWidth($ListView, 0, 100) works fine but
_GUICtrlListView_SetColumnWidth($ListView, 0, "100") doesn't.

This bug was found calling the UDF with a numeric value read from file as a string. The UDF source reveals that GUICtrlSendMsg is called without typecasting to the correct lParam type. Appearently GUICtrlSendMsg doesn't do it either, which is an even more severe bug.

Demo: slightly extended demo from _GUICtrlListView_SetColumnWidth demo in help file. See below.

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

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

_Main()

Func _Main()
	Local $hListView

	GUICreate("ListView Set Column Width", 400, 300)
	$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
	GUISetState()

	; Change column 1 width
	MsgBox(4160, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($hListView, 0))
	_GUICtrlListView_SetColumnWidth($hListView, 0, 150)
	MsgBox(4160, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($hListView, 0))
; next setting cases wrong setting/shows bug
	$temp = "200"
	_GUICtrlListView_SetColumnWidth($hListView, 0, $temp)
	MsgBox(4160, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($hListView, 0))

	; Loop until user exits
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE

	GUIDelete()
EndFunc   ;==>_Main

Attachments (0)

Change History (1)

comment:1 Changed 11 years ago by Gary

  • Resolution set to No Bug
  • Status changed from new to closed

if you are passing a string you need cast the type.

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 ticket will remain with no owner.
Author


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

 
Note: See TracTickets for help on using tickets.