Sign in to follow this  
Followers 0
alawoona

Au3gui Objects And Controls

7 posts in this topic

I have almost completed writing a script that uses an AU3GUI gui to build other gui's and then writes the AU3GUI code to a script file. I am trying to incorporate some of Larry's cool guiasst code to help move controls around and resize them. My script will create a bunch of AU3GUI objects 1, 2, 3, 4, etc. These generally corrspond to the order in which WinGetClassList will return controls - Static1, Edit1, Edit2 etc. But not always. For example, I have a picture as OBJ15 but it shows up as Static1 from WinGetClassList, even when there are other Label objects as OBJ1, OBJ2 etc. Is there a relationship between the OBJ numbers and the information returned by WinGetClassList. Also noted that a combobox object results in two controls - and Edit and a Combo when returned by WinGetClassList.

Hopefully my question is understandable - too many glasses of red wine here makes it tough to write.

Share this post


Link to post
Share on other sites



You can't rely on what WinGetClassList returns as related to the OBJ number.

A combo-box IS 2 controls. Its just a convient way to create an edit field with a listbox associated with it.

Share this post


Link to post
Share on other sites

Yeah - figured that would be the answer for the combobox observation.

Let me ask my question another way. I know the AU3GUI OBJ number and object type for each of the objects in my gui. How can I determine what the classnameNN will be for a particular OBJ number & type so I can address that control directly with the control functions in AutoIT3? If there is no relationship then I think I am screwed.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The best solution I can think of is set the text parameter for each control to something your script will be able to internally recognize. Then you can search for a specific control by reading the text of all the controls until you find the one you want. For a combo or listbox, just set some data that you can read. I don't know what to do in the case of a picture or icon control, however.

Edit: The same holds true for anything about the control, including the size and position.

Edited by Valik

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Good suggestion - I will give that a try, it just might get me there. It probably won't be pretty but it might just work.

Edited by alawoona

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ironically, I just ran into a problem where I had to programmatically get the class instance of a control at run time. Here's something that might help you:

ControlFocus("Test GUI", "", "Input 3")
$res = ControlGetFocus("Test GUI")

What that does is uses the new text maching logic instead of a class name. By setting focus to the control, then using ControlGetFocus, I get the class instance. This seems to be an acceptable solution for now (Untested on disabled/hidden controls...).

Idea: In the future, we need a function to return the class instance of a control using text match to find it.

Edit: ControlFocus fails on a disabled control (as I expected it might). It works on hidden controls.

Edited by Valik

Share this post


Link to post
Share on other sites

There is a 1-1 correspondence between the AU3GUI Objects and the WinGetClass return, EXCEPT when there is a picture Object present (and presumably when there is an icon Object presnet, though I have not tested it)

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