ComponentOne Sizer 8.0
AutoSwitch Property

Returns or sets whether the control automatically switches pages when the current tab changes.

Syntax

[form!]C1Tab.AutoSwitch[ = {True | False} ]

Remarks

If AutoSwitch is set to True, the IndexTab control switches tab pages automatically when a new tab is selected. It will also resize the current page to fit the IndexTab's client area.

The size of the client area is determined by the size and position of the tabs plus a border that is set using the BorderWidth property.

The Tab control fires the Switch event before each switch, so you can validate the current page and even cancel the switch. The Tab control fires the Click event after the switch, so you can update the form based on the new selection.

To use the AutoSwitch feature, you will typically create one "page" (container control) for each tab. The Tab control then takes care of switching and resizing the pages whenever a tab is selected. To determine which page belongs to each tab, the Tab control assumes that the leftmost page belongs to the first tab, the second from the left to the second tab, and so on.

The AutoSwitch feature also works at design time. To activate a tab, click on it with the mouse. The tab will become active, and its container will be displayed just as it would at runtime. This makes form design easy. To associate containers to tabs, click on the current tab. This causes all tabs to be de-selected and the containers to be tiled. Reorganize the tabs by dragging them around until they are in the proper order.

If AutoSwitch is on and CurrTab is set to a number greater than the number of pages, the last page is shown. This is useful if you have a single page in the Tab control because it automatically sizes the page when the control is resized.

Note: When the Tab control switches the current tab, it enables the current page and disables all others. This is done to prevent users from activating hidden controls by mistake, using the keyboard. If you need to enable and disable controls inside a Tab control, you can either (1) enable and disable the controls within each page, or (2) nest two container controls on each page, then enable and disable the inner one with code while the Tab control handles the outer one.

Data Type

Boolean

Default Value

True

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback