Modify

Opened 7 years ago

Closed 7 years ago

#3622 closed Bug (No Bug)

AU3_ControlCommandByHandle FindString in ListBox

Reported by: ctrirxu@… Owned by:
Milestone: Component: AutoIt
Version: 3.3.14.5 Severity: None
Keywords: FindString ListBox Cc:

Description

AU3_ControlCommandByHandle FindString in ListBox return 0 if not found as the ListBox is 0 based.

Should return -1 like ::SendMessage(h, LB_FINDSTRINGEXACT, 0, L"") does

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Melba23

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

If the string is not found then @error is set - use this to differentiate between the 2 cases:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$cList = GUICtrlCreateList("", 10, 10, 200, 200)
GUICtrlSetData($cList, "A|B|C|D|E")

GUISetState()

$iRet = ControlCommand($hGUI, "", $cList, "FindString", "F")
ConsoleWrite("Not in list = F: " & $iRet & " - error: " & @error & @CRLF)

$iRet = ControlCommand($hGUI, "", $cList, "FindString", "A")
ConsoleWrite("In list = A: " & $iRet & " - error: " & @error & @CRLF)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
	EndSwitch
WEnd

M23

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.