Tabs and Sub-Tabs

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
lebrocoli
Pro Scripter
Posts: 53
Joined: Tue Sep 06, 2005 9:28 pm

Tabs and Sub-Tabs

Post by lebrocoli » Wed Oct 10, 2007 6:12 pm

Hi!

In an area of my app I test, there are tabs that I want to select. These tabs do not have accelerator keys. Fo now, let's assume that I do not want to select the tabs with my mouse.

I was trying to use this example stated on your web site:

==============================================
//Initialise constants
Let>TCM_GETCURSEL=4875

//Get the handle of the Display Properties Window
GetWindowHandle>Display Properties,hwnd

//Find the handle of the SysTabControl32 (Tab Control) object
LibFunc>User32,FindWindowExA,tabctrl,hwnd,0,SysTabControl32,

//Send the TCM_GETCURSEL message to retrieve the selected tab index
LibFunc>user32,SendMessageA,tabindex,tabctrl,TCM_GETCURSEL,0,0

//Display the result
MessageModal>Selected Tab: %tabindex%
============================================


Question 1: Now that I have my tab index, how, inside my script, do I select the tab ?

Question 2: The tab has also sub-tabs. What do I need to change in the script given on your website so I can get the index of the sub-tab instead ?

Thanks for all your patience.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Oct 11, 2007 7:20 am

Use CTRL+TAB to move from one tab to the next. So once you know which tab is already selected you then know how many times you need to send CTRL+TAB:

Press CTRL
Press Tab
Release CTRL

If by sub tabs you mean another tab control that is a child of a main tab control then you would need to use another FindWindowExA call to get the handle. FindWindowEx gets the handle of a control, belonging to a parent, relative to another.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts