Modify

Opened 7 years ago

Closed 7 years ago

#3638 closed Bug (No Bug)

_GUICtrlListView_GetItemText online documentation error

Reported by: tatane Owned by:
Milestone: Component: Documentation
Version: 3.3.14.0 Severity: None
Keywords: Cc:

Description

There is an error in the description of the parameters of _GUICtrlListView_GetItemText function :

It says for the first parameter "$hWnd" : "Control ID/Handle to the control"
Handle is working, not Control ID (no conversion in the UDF)

Thanks

Change History (3)

comment:1 Changed 7 years ago by Jpm

THe example in the doc is using the Control ID so I Don't understand
PLease provide a repro script

comment:2 Changed 7 years ago by anonymous

You're right the example is working fine.
It's a problem with _GUICtrlListView_GetItemText and _GUICtrlListView_GetSelectedIndices.
Maybe i'm using it the wrong way. Please check the code below :

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Opt("GUIOnEventMode", 1)

Global $idListview = 0

Example()

Func Example()
    Local $bgetitemname

    GUICreate("ListView Get Item Text", 200, 300)
    $idListview = GUICtrlCreateListView("", 2, 30, 100, 258, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_REPORT))
	GUISetOnEvent($GUI_EVENT_CLOSE, "guiclose")
	$bgetitemname = GUICtrlCreateButton("get item name", 5, 5)
	GUICtrlSetOnEvent($bgetitemname, "getname")

    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 100)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Item 1")
    _GUICtrlListView_AddItem($idListview, "Item 2")
    _GUICtrlListView_AddItem($idListview, "Item 3")

    ; Loop until the user exits.
    While 1
		Sleep(100)
    WEnd
EndFunc   ;==>Example

Func getname()
	MsgBox($MB_SYSTEMMODAL, "Information", "Item Text without handle: " & _GUICtrlListView_GetItemText($idListview, _GUICtrlListView_GetSelectedIndices($idListview)))
	MsgBox($MB_SYSTEMMODAL, "Information", "Item Text: " & _GUICtrlListView_GetItemText(GUICtrlGetHandle($idListview), _GUICtrlListView_GetSelectedIndices($idListview)))
EndFunc

Func guiclose()
	Exit
EndFunc

comment:3 Changed 7 years ago by Jpm

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

Your pb come from the fact that _GUICtrlListView_GetSelectedIndices() return a string that need to be convert as an integer Int(_GUICtrlListView_GetSelectedIndices(…)
I Don't know why the the second call get a good result

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

Author


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

 
Note: See TracTickets for help on using tickets.