Jump to content
Sign in to follow this  
Rishav

Can't check listbox item

Recommended Posts

Rishav

Hi folks

I have a problem with listboxes.

I have a listbox which shows me the sheet names form a selected excel.It will show the last element selected by default.

Posted Image

the code I am using is;

ControlFocus("myapp", "Sheet Details:", $hwnd)
_GUICtrlListBox_SelectString($hwnd, "Sheet4", -1)
send("{SPACE}")

Problem is that the checkbox and the selection aren't tied to each other. SO I have to send an extra spacebar press to check the item. Now if I wanted to check Sheet4 item in the listbox and if its already checked, it will simply uncheck it (as spacebar is still pressed)

I need a way of finding if the item at a certain index is checked or not. Or if possible, set check or uncheck on it irrespective of its current check status.

please note that the control id is for the entire list box and I can't have the controls for each element in the listbox.

any ideas?

regards

Rishav

Edited by Rishav

Share this post


Link to post
Share on other sites
SmOke_N

Most people here use Excel.au3 file in the Example scripts to manipulate data in excel.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Rishav

Can't help that. T_T

i am trying to automate my company's product.

Share this post


Link to post
Share on other sites
Rishav

so any ideas?..... :D

Edited by Rishav

Share this post


Link to post
Share on other sites
Rishav

bumping it again. Any ideas anyone?

Share this post


Link to post
Share on other sites
reikenberg

Try a {TAB} instead of {SPACE}, worked for me.

added: ups, will not slove your checkbox problem

Edited by reikenberg

Share this post


Link to post
Share on other sites
vimala

Hi folks

I have a problem with listboxes.

I have a listbox which shows me the sheet names form a selected excel.It will show the last element selected by default.

Posted Image

the code I am using is;

ControlFocus("myapp", "Sheet Details:", $hwnd)
_GUICtrlListBox_SelectString($hwnd, "Sheet4", -1)
send("{SPACE}")

Problem is that the checkbox and the selection aren't tied to each other. SO I have to send an extra spacebar press to check the item. Now if I wanted to check Sheet4 item in the listbox and if its already checked, it will simply uncheck it (as spacebar is still pressed)

I need a way of finding if the item at a certain index is checked or not. Or if possible, set check or uncheck on it irrespective of its current check status.

please note that the control id is for the entire list box and I can't have the controls for each element in the listbox.

any ideas?

regards

Rishav

hello Rishav

Have u used these commands which iam giving below ? It will select both the checkbox and listitems.look into the

script i have used _GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2)(no 2) at the last of this function and why do u need for each element.?it will click twice one for item and second click for checkbox.

$hwnd=ControlGetHandle("title","text","ControlID")

$ListboxIndex = _GUICtrlListBox_SelectString($hWnd, "Sheet4")

_GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2)

Share this post


Link to post
Share on other sites
vimala

hello Rishav

Have u used these commands which iam giving below ? It will select both the checkbox and listitems.look into the

script i have used _GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2)(no 2) at the last of this function and why do u need controlid for each element.?it will click twice one for item and second click for checkbox.

$hwnd=ControlGetHandle("title","text","ControlID")

$ListboxIndex = _GUICtrlListBox_SelectString($hWnd, "Sheet4")

_GUICtrlListBox_ClickItem ($hwnd,$ListboxIndex,"",False,2)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.