Jump to content
Sign in to follow this  
Erion

How to click on a SysTreeView32 tree item?

Recommended Posts

Erion

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

Share this post


Link to post
Share on other sites
FireFox

Hi,

You can get the treeview control ID with the au3info then manipulate it with the _GUICtrlTreeView_* functions.

Br, FireFox.

  • Like 1

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Erion

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

Share this post


Link to post
Share on other sites
FireFox

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Erion

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

Share this post


Link to post
Share on other sites
FireFox

If I can't test it myself then I can't help you further than I already did.

  • Like 1

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Erion

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

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  

×