Jump to content

Trouble accessing list boxes


Amani
 Share

Recommended Posts

I'm working with a 3rd party app and trying to access/manipulate a

ListBox control. I'm able to do a ControlCommand(..."Select String");

likewise, I can do a "GetCurrentSelection".

But the ControlListView command invariably fails, using the same

title/text/ctrlID arguments. Hence, I cannot observe the options.

Since there's some run-time variation in the available options,

being able to count and observe them is critical.

Any suggestions would be appreciated.

Link to comment
Share on other sites

Still stuck on this guy. Since the LB is in a 3rd-party app,

I didn't create it. I've looked at the _GUI* functions, but

it looks like those are geared strictly toward GUI elements

created by the AutoScript.

So, to be clear, the following works fine:

ControlCommand($winTitle, $winText, $listBoxCtrlID, _

"SelectString", "foo")

But if I try this, the item count always comes back zero,

regardless of how many items are in the list

ControlListView($winTitle, $winText, $listBoxCtrlID, _

"GetItemCount")

Oddly enough, @error is also zero, so the ControlListView

call seems happy enough.

Any tips would be appreciated.

Link to comment
Share on other sites

Perhaps (being only slightly familiar with Windows programming), "ListView" and

"ListBox" are different, and one should not use ControlListView with a ListBox

control?

Are there other functions beside ControlCommand that might give me visibility

to the options available in a ListBox? I haven't found them yet in the

function reference.

Link to comment
Share on other sites

  • Moderators

Amani,

one should not use ControlListView with a ListBox control

Correct - ListBoxes and ListViews are very different beasts. :(

What does the Au3 Window Info tool tell you about the control, particularly its CLASS? :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

That's what I was afraid of.

The class is "ListBox".

So, did I just miss some utilities for observing/manipulating ListBox

controls? I didn't see a good way to observe the available selections

using the ControlCommand function.

Really appreciate your feedback.

Link to comment
Share on other sites

  • Moderators

Amani,

The GUICtrlListBox_* functions might be of use here - look in the Help file under <GUIListBox Management>.

But have you tried ControlGetText? If you can get the displayed text and you know the various options you could well be able to parse the result and see what is available at that moment.

It is a bit difficult to go any further as I cannot work on the control myself - but the fact that you can get some returns from the control makes me think that there is room for optimism. :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Okay, that worked, thank you. I was using the online documentation, rather than the help file, so I missed all the _GUICtrlListBox functions that take a handle.

I now use ControlGetHandle to get the ListBox control handle. From that, I'm able to use the _GUICtrlListBox functions to examine and manage the list box.

Really appreciate the help.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...