Sign in to follow this  
Followers 0
mihaibr

How to verify if a listbox has items checked.

6 posts in this topic

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 :(

Share this post


Link to post
Share on other sites



Oups, _GUICtrlListBox_GetSel was doing this, sorry for this topic :(

Share this post


Link to post
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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@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

Share this post


Link to post
Share on other sites

ooo yes, I apologize` I was not paying attention to details

Share this post


Link to post
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
Sign in to follow this  
Followers 0