Quick Find: Search for:

 Total Access Components
Control Tour

Return to Components Home
 

 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

About Box

AVI (Video)

Bitmap Effects

Border
Browse for Folder New!
CD Player
Clipboard
Clock
Common Dialogs
Date Time Picker New!
Digital Display
Enhanced Button
Gauge
Icon Menu
INI File
Marquee
Notes
Popup Menu
Progress Meter
Registry
Resize
Slider
Spin Button
Splitter
System Info
Tab Strip
Text Effects
Timer
Wave
 

 

Total Access Components Tour: Tab

The Tab control, also known as a tabbed divider, is one of the more useful Windows controls because it allows many other controls to be grouped or organized using a visual metaphor with which most users are familiar. The Total Access Components Tab control allows you to achieve the same effect. This control can be databound.

Microsoft Access includes a built-in Tab control. The Access Tab control provides a more convenient method for containership than the Total Access Components Tab control, however the Total Access Components Tab control provides some features not found in the Access Tab control. These features include databinding, a Windows 3.1 appearance, and the ability to displays tabs on the left, bottom, or right of the control. If you need any of these features, consider using the Total Access Components Tab control. Otherwise, using the Access Tab control is generally a better solution.

Issues with Containership

If you have used Tab controls in other development environments such as Visual Basic, you are familiar with the concept of containership. For example, in a Visual Basic Tab control, each page of the tab control can contain other controls-when you click on different tabs, the tab control automatically displays the controls that the page contains. Unfortunately, Access does not support containership for custom controls. Because of this, the Total Access Components Tab control cannot automatically show or hide controls depending on which page is active. Fortunately, writing the code to make this work is quite easy.

The Demo files contain several examples of working around the containership problem. When a different tab on the Tab control is selected, you can:

  • Cycle through the appropriate controls and set the Visible property to True or False, depending on whether that control belongs to the current page.
  • Use subform controls to group and contain objects.

Issues with Paint Over

An additional Access-related problem is that custom controls are higher in the Windows z-order than most other Access controls. This means if you place an Access text box control on top of a custom control in design view, and then view the form, the text box goes behind the custom control and is not visible. This happens even when you use the Bring To Front command on the Access menu. There are two ways to get around this problem:

Use the Total Access Components Tab control as a “strip control.” This means that you size the Tab control to be tall enough to contain just the tabs. You then set the BodyStyle property of the Tab control to open. This displays a partially-complete tab control on your form. Add an additional Access rectangle control to your form to complete the overall look. Set the rectangle control’s Special Effect property to “Raised”, and set the Tab control’s Appearance property to “Win95”. Finally, use the mouse or the arrow keys to line the rectangle up with the Tab control. Switch to form view mode to ensure that all controls line up.

Place a Tab control on your form and size it to be a tab “strip.” When its appearance is correct, create another Tab control with the same property settings. Then use the “Convert To Picture” Access operation to convert the second tab control to a picture. Since the second Tab control is now a picture, it is always displayed behind other controls.

Fonts and Tab Location

If you set the TabLocation property to Left or Right, the Tab control automatically rotates the tab text. However, in Windows, only TrueType fonts can be rotated. If you use the Left or Right orientations, you must specify a TrueType font for the tab text, or the text does not display correctly.

Using the Tab Control

There are three basic steps for using the tab control:

  • Step 1 - Set up the tab and associated controls
    Place the following on the form: the tab control, a raised rectangle, and all the controls to be “contained” by each tab. The edges of the tab control and the rectangle, which act as the visual “folder,” should be aligned next to each other.
  • Step 2 - Modify the tab control’s properties
    Open the Tab control’s property sheet by right-clicking on the control, selecting FMS Tab Control 2002 Object, and choosing Properties. To emulate the look of a tab control in the Windows environment, set the BodyStyle property to 0 - Open. The Appearance property can be set to 0 - Win31, or 1 - Win95. You can set the tabs to appear at the top, bottom, left, or right of the folder by modifying the TabLocation property. Set each tab’s caption with the TabText property. Select an individual tab to modify by changing the Value property.
  • Step 3 - Write code to handle the display of each tab on the control
    By responding to the OnChange event of the tab control, you can set the Visible property for each control “contained” in the tab control, which simulates changing tabs.

Tab Properties

Name

Description

Appearance

The tab style.

BackColor

The background color of the control.

BodyStyle

The tab control body style.

Enabled

Whether the user can modify the control.

Font

The font displayed in the tabs.

TabCount

The number of tabs in the control.

TabLocation

The location of the tabs.

TabText

The text displayed in the tab.

Value Default Databound

The currently selected tab.

Tab Events

Name

Description

Click

Fires when the mouse is clicked over the control.

DblClick

Fires when the mouse is double clicked over the control.

KeyDown

Fires when a key is depressed.

KeyPress

Fires when a key is pressed.

KeyUp

Fires when a key is released.

MouseDown

Fires when a mouse button is depressed over a control.

MouseMove

Fires when the mouse moves over the control.

MouseUp

Fires when a mouse button is released over a control.

OnChange

Fires when the user changes the value of the control.

Questions  l   Web questions: Webmaster   l   Copyright © 2008 FMS, Inc.

Celebrating 21 Years of Software Excellence