Posts: 129
Threads: 38
Joined: May 2006
I am able to get the count of items in a list box using GetListViewItemText. I am able to the text of any items in the list box. The problem is, I am having a difficult time selecting the item :lol:
For example, the list box contains 20 items. I am able to get the name of the 16th item, but not able to select it. I have tried LB_SelectString to select the actual string and I have also tried LB_SelectItem using the index number, but it's not working.
Help please.
Posts: 12,140
Threads: 142
Joined: Dec 2002
There are two different types of list controls. Controls that have ListBox classname (simple listboxes) and controls that have SysListView32 classname (like in Windows Explorer). LB_x functions work only with ListBox controls. GetListViewItemText works only with SysListView32.
Use accessible object functions instead. There are dialogs in the floating toolbar.
Posts: 129
Threads: 38
Joined: May 2006
Ahhhh ok, yes it is SysListView32. Thank you so much!
Posts: 129
Threads: 38
Joined: May 2006
If the item is from items 1-10, acc finds it. But any item after that, which are not showing on the screen, I am getting an object not found.
Posts: 12,140
Threads: 142
Joined: Dec 2002
In the "Find accessible object" dialog, click Options and check Invisible.
Posts: 129
Threads: 38
Joined: May 2006
Im getting Error (RT) in Macro: the point is outside the window
Posts: 129
Threads: 38
Joined: May 2006
Ok nevermind, I got it working :wink:
Thank youuuuuuu!
Posts: 129
Threads: 38
Joined: May 2006

Now it is selecting the item in the lisbox, problem is, I can't use 'Y to press the enter key or do mouse action because it does not show on the screen
What to do next so I can click on the item?
Posts: 12,140
Threads: 142
Joined: Dec 2002
To click, use a.DoDefaultAction.
a.Select(3); key Y
also works for me. To use mouse, need to scroll into view. It is possible but not easy.
Posts: 129
Threads: 38
Joined: May 2006
Mouse or Keyboard does not work unless the object is showing on the screen. I also tried DoDefaultAction, didn't work as well. So the work around I was able to think of was to use:
It takes forever sometimes because the list box can contain up to 500 items. So you can just imagine if I would like to jump to item 300
Ohhhh I have a headache
Posts: 12,140
Threads: 142
Joined: Dec 2002
Try MouseWheel.
act child("" "SysListView32")
key CH
MouseWheel -a.elem/3+1
Here 3 is the number of lines scrolled by single wheel tick. It may be different on your computer. 3 is default setting.
Posts: 129
Threads: 38
Joined: May 2006
Wow, so much faster than my rep 'D :lol:
Good morningggggggg!
Thank you so much.
Posts: 129
Threads: 38
Joined: May 2006
Maybe this is too much, but would you kindly please explain what MouseWheel -a.elem/3+1 means? I pressed F1 on MouseWheel and there was not any explantion :lol:
When it hits the last item on the list, it just keeps on scrolling. Maybe I can make modifications if I knew what it mean.
Thank you.