Jump to content

How to verify if a listbox has items checked.


mihaibr
 Share

Recommended Posts

Hi,

How can I verify if a listbox (with checkable items),has checked items?

The listbox is not in my application (is in a external application).

I want to find out what item is checked, and if it's possible ,how to check items(from the same listbox)

The listbox looks like this:

Posted Image

And here is the Summary from Autoit Windows Info:

>>>> Control <<<<

Class: ThunderRT6ListBox

Instance: 1

ClassnameNN: ThunderRT6ListBox1

Name:

Advanced (Class): [CLASS:ThunderRT6ListBox; INSTANCE:1]

ID: 6

Text:

Position: 127, 47

Size: 97, 94

ControlClick Coords: 27, 47

Style: 0x540100D9

ExStyle: 0x00000204

Handle: 0x000104E2

Please excuse my poor/bad English :(

Link to comment
Share on other sites

Exemple:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 106, 110, 192, 114)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 8, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 8, 24, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 8, 40, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 8, 56, 97, 17)
$Button1 = GUICtrlCreateButton("Button1", 16, 80, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   $text = ""
If GUICtrlRead($Checkbox1) = "1" Then
$text = $text & "Checkbox1 "
EndIf
If GUICtrlRead($Checkbox2) = "1" Then
$text = $text & "Checkbox2 "
EndIf
If GUICtrlRead($Checkbox3) = "1" Then
$text = $text & "Checkbox3 "
EndIf
If GUICtrlRead($Checkbox4) = "1" Then
$text = $text & "Checkbox4 "
EndIf
MsgBox(0,"",$text)
EndSwitch
WEnd
Link to comment
Share on other sites

@incepator,

the OP is talking about a non AutoIt application. Your approach doesn't work then.

Best bet is _GUICtrlListBox_GetSel.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@incepator,You totally missed the topic subject.

I made a simple exemple(if someone need this)

#include <GuiListBox.au3>
$hlist=ControlGetHandle("SURSA","","[ID:1]");Replace with your appname,and with the control ID
        $iCount=_GUICtrlListBox_GetCount($hlist)
        For $i=0 To $iCount-1
        MsgBox(0,"Item " & $i & " status",_GUICtrlListBox_GetSel($hlist,$i))
   Next
Edited by mihaibr
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...