Sign in to follow this  
Followers 0
nugame

ControlListView not selecting

10 posts in this topic

I hope I am in the right place this time. Learning my way around the forum.

I have the following code for a window invoked by a menu selection. The window has a listbox along with some buttons and a combobox. I need to select the date in the listbox to generate a report.

WinWait("Report","")

If Not WinActive("Report","") Then WinActivate("Report","")

; Select second dated item in select date listbox on the first go around

ControlListView ( "Report", "", "ListBox1, "Select",1)

It does not select the item in the listbox. In fact, it does nothing. When I use the following:

MouseMove(90,87)

MouseDown("left")

MouseUp("left")

I get results as expected. I need to use the ControlListView so I can get the content of the listbox for next dated item. After, searching the forum, I get the feeling that ControlListView has a problem. If not, could you tell me what I am doing wrong.

thanks


Dr SherlockAlways a way

Share this post


Link to post
Share on other sites



AFAIK, ControlListView can only be used for ListViews, not ListBoxes.

Make sure "ListBox1" is correct, and try this:

ControlCommand("Report", "", "ListBox1", "SetCurrentSelection", 1)

btw, your three Mouse functions can be accomplished in one:

MouseClick("left", 90, 87, 1, 1)

(But it's much better to interface with the controls directly)


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

More figuring out and realize the focus for ControlListView. I replaced with the MouseClick and the first pass is done. I did try the ControlCommand with ListBox1 and it did not work. I traced the code and I know every line is processed. I like to be able to interface with the the listbox to find the item to select instead of do this the long way.

I composed a quick test program using wordpad and ControlCommand to select a font item in a combobox, it worked fine. I executed in the beta version and still unsucessful. Any thoughts? thanks


Dr SherlockAlways a way

Share this post


Link to post
Share on other sites

More figuring out and realize the focus for ControlListView. I replaced with the MouseClick and the first pass is done. I did try the ControlCommand with ListBox1 and it did not work. I traced the code and I know every line is processed. I like to be able to interface with the the listbox to find the item to select instead of do this the long way.

I composed a quick test program using wordpad and ControlCommand to select a font item in a combobox, it worked fine. I executed in the beta version and still unsucessful. Any thoughts? thanks

Can you post the complete script you use to demonstrate that the beta is not working as the official release so I can analyse the difference

Thanks :D

Share this post


Link to post
Share on other sites

Can you post the complete script you use to demonstrate that the beta is not working as the official release so I can analyse the difference

Thanks :D

I attached the code. I made notes to the commented lines that did not work. I hope this will help you help me.

thanks

Copy_of_laborreport.au3


Dr SherlockAlways a way

Share this post


Link to post
Share on other sites

I attached the code. I made notes to the commented lines that did not work. I hope this will help you help me.

thanks

Thanks but I cannot really debug your script as the script stop on first WinWait("xxxxx yyyyy","").

Can you have a really COMPLETE script running?

The only think I can say is the ControlListview certainly do there action if the control referenced is really a ListView control but that will not do anything about mouseClick

For controlClick I hope the controlID 1190 or 2 are the valid one. Reread the doc remarks to be sure you fullfil the requirements. :D

Share this post


Link to post
Share on other sites

I am doing the automation for someone and really cannot show object names. It is an expensive POS network which I need to respect their licenses. I had hoped you could comment on my possible error(s) on the use of listview or possibly errors in the ControlListView itself. The controlID is what the Autoit Window Info showed. Skruge commented that this command can only be used with listview and not listboxes or comboboxes. If this is true, then what is the process other than mouseclick to select one or more items in the listbox. :">


Dr SherlockAlways a way

Share this post


Link to post
Share on other sites

OK. Need some clarification and help here. Word has it the ControlListView can only be used for ListView not listboxes. However, listbox derives from listview32. What is the difference? Also, AutoIt Windows info shows the object to be a ListBox1. I also use ControlCommand("Report", "", "ListBox1", "SetCurrentSelection", 1) and that did not do it. Any suggestions? - thanks


Dr SherlockAlways a way

Share this post


Link to post
Share on other sites

Skruge commented that this command can only be used with listview and not listboxes or comboboxes. If this is true, then what is the process other than mouseclick to select one or more items in the listbox. :

Multi-select ListBoxes are significantly different from Single-select ListBoxes. As a result, most of the ControlCommand functions won't work on them.

Grab the latest beta and take a look at the _GUICtrlList... functions in GUIList.au3.

#include <GuiList.au3>oÝ÷ Ù:ò¶¬jÖ¢ëew¸íúè*.®â)ÚÊy«­¢+ØìM±Ð¥ÉÍÐѥѴ¥¸Í±Ðѱ¥Íѽà(ÀÌØí¡1¥ÍÑ    ½àô
½¹Ñɽ±Ñ!¹± ÅÕ½Ðí1½ÈIÁ½ÉÐÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí1¥ÍÑ ½àÄÅÕ½Ðì¤)}U%
Ñɱ1¥ÍÑMÑM° ÀÌØí¡1¥ÍÑ   ½à°Ä°È¤ìM±Ð¥Ñ´Ð¥¹à

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

That did it for the combo and list boxes. I know the different includes has to be included. So, I have to get the handle for all control objects. ControlID does not work. Thanks for the help!!!!


Dr SherlockAlways a way

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