Sign in to follow this  
Followers 0
QA Stooge

Finding Out What Ctrl_id Was Clicked

3 posts in this topic

#1 ·  Posted (edited)

Suppose GUIOnEventMode is turned on.

Suppose you have 3 GUIs you made with a script.

Suppose each GUI has a ListView control with a dynamic list of assorted ListViewItems (so you can't make any script that calls that LVI specifically).

Suppose you need to do something on a GUI when a ListViewItem is clicked on that same GUI.

Now think about the fact that you have one one while(1) loop.

With this single while loop you need to have a listener

- find out whether you just clicked any ListViewItem on any ListView in any GUI.

- find out what the Ctrl_ID of that ListView Item is, so you can do something with it.

... ... okay let me put it to you this way...

Basically, if there was a GUICtrlGetClickedID() {returns the CtrlID of whatevet control was clicked} my life would be wonderful.

Anything like that?

Edited by QA Stooge

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Have you looked into the Beta Version of AutoIT. it has a LOT more controls for the Listview stuff. such as

_GUICtrlListViewGetSelectedIndices : Retrieve indices of selected item(s) in a list-view control

you would have to put in the loop to poll each of the list views, and write the currently selected items to variables, then on every poll if they do not return what is in the variables, then something else was selected.

Mike

Edit: I like your screen name, I also am a QA stooge

Edited by MikeOsdx

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Have you looked into the Beta Version of AutoIT. it has a LOT more controls for the Listview stuff. such as

_GUICtrlListViewGetSelectedIndices : Retrieve indices of selected item(s) in a list-view control

you would have to put in the loop to poll each of the list views, and write the currently selected items to variables, then on every poll if they do not return what is in the variables, then something else was selected.

Mike

The problem I found with that set of UDFs is that it uses LVItem indices, not control IDs. In fact, control IDs sometimes get destroyed and remade without any kind of tracking. What I need is to be able to click on a LVI and for that click to be detected and somehow allow me to find out what the Control ID of any unknown LVI is.

Main reason is that I modified the Ctrl creation such that each control gets added to a 2-D array of the form...

{$CtrlID (@GUI_CtrlID),

$CtrlType (string, like "listview" or "button"),

$CWinHandle (@GUI_WinHandle),

$CParent (usually blank, else the @Ctrl_ID of a "parent control" like the listview if this item is an LVI)}

With this I can sort LVIs, and read&alter states of controls that have nothing to do with the one being interacted with. For example, when I click an LVI, the script accesses a data file that holds the big list of info represented by the LVI control and displays it to a read-only edit control. Check out the attached screenshot.

Edit: I like your screen name, I also am a QA stooge

Thanks :) Edited by QA Stooge

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