Understanding Infragistic controls: Tab Control
Test and Monitor | Posted February 05, 2007

Working with the Tab Control is actually pretty simple. You may need two operations to work with a tab control, one for getting the selected page and another for selecting a page.

To retrieve the currently selected page, you can use the get_SelectedTab() method or the SelectedTab property. Both return a tab object whose Text property you can use to retrieve the selected page.

Here is an example:

You need to make sure that you do not mix up SelectedTab and ActiveTab, since they are two different properties and a tab may be active, but not selected.

To get the list of pages in a tab control you can use the Tabs.Item_2 property, and to select a page, the set_SelectedTab() method.

Below is a simple code sample:

The above example has some disadvantages. There may be invisible tabs in the Infragistic tab control and this code doesn't check whether the tab is visible or not. If you try to use this function to select the invisible tab it will return true, but the tab won't be selected. So, you have to modify the function to check whether the tab is visible and then you can use it.

Also it is very useful to have the ability to select a tab by not only using its full name, but using a part of its name. The example below illustrates the modified function:

Now, you can select a page even if you don't know it's full name. For example, if you have a tab with the "Computers(...)" caption, where "..." is the number of computers and can be any integer (0, 5, 167, etc.). You can call this function as shown below:

ITabSelect(oTab, "Computers")

TestComplete 6 has built-in support for this feature. Click the link below to read more about the TestComplete 6 features:

TestComplete 6 Features


By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox