Jump to content

How to click on a SysTreeView32 tree item?


Erion
 Share

Recommended Posts

Hello,

I'd like to add enhanced keyboard access to an application written by someone else. This app has a standard treeview control, which gets populated upon a left single click on one of its predefined items (sending an Expand message is not possible).

Thus, I'd like to simulate a left single click on the currently selected item, i.e. the one that has keyboard focus.

My problem is that I'm unable to find any either built in or custom UDf method that'd either give me the absolute screen positions of the currently selected item, or click on any item inside the tree (since GetSelectedItem could be used to get the index/reference). Does anyone have a possibly working solution for this please?

Erion

Link to comment
Share on other sites

Hi,

Thank you very much for your reply!

Unfortunately we cannot gain access to the control ID of a currently selected item in the tree view (I'm not sure it has one, either). I can use, for example "[CLASS:SysTreeView32]" as the control ID, however clicking on it would result in clicking on the centre of the treeview control, rather than on the currently selected item. So far I've managed to find only one function that would retur an item's reference, but it does not seem to work when I tried to get it's position (the function returned 0 and 0 was in @error, too).

Erion

Edited by Erion
Link to comment
Share on other sites

Ok.

that'd either give me the absolute screen positions of the currently selected item

Why do you need this information?

Once you've clicked on it, just use the Send or ControlSend command to navigate through the treeview.

Br, FireFox.

Link to comment
Share on other sites

Hi,

Once you've clicked on it, just use the Send or ControlSend command to navigate through the treeview.

yes, that would be the second step. But to expand items, I need to click on them, since that is when new items are added to the tree. Expanding or collapsing previously added items work fine.

so, we need to:

1. Get some info regarding the currently active treeview item that has focus (either position on the screen, a reference, etc)

2. Simulate a left single click

3. The tree gets populated with new items.

Thanks,

Erion

Link to comment
Share on other sites

Hi,

After some further testing it turns out that the [CLASS:XXX] reference was not converted to a proper handle that Windows was expecting.

Here is some makeshift code to click on the focussed item in the AutoIt help file (autoit.chm)

global $th, $ih ;Tree and item handles
;Let's wait for the AutoIt Help window.
WinWaitActive("AutoIt Help")
#include <GuiTreeView.au3>
;get the selected item
$th=ControlGetHandle("AutoIt Help","",ControlGetFocus("AutoIt Help"))
;Get currently selected TreeView item
$ih=_GUICtrlTreeView_GetSelection($th)
;perform a single click
_GUICtrlTreeView_ClickItem($th, $ih)

Erion

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...