A new tab was clicked and is about to become active.
| VB | Private Sub object_TabClicked(ByVal DblClick As Boolean, ByVal TabClicked As Integer, ByVal TabArea As SftTabsTabAreaConstants) |
object
A SftTabsEvents object.
DblClick
True if a mouse button double-click occurred, False if the mouse button was clicked once.
TabClicked
The zero-based index of the tab that was clicked.
TabArea
Describes the area within the tab that was clicked.
| Name | Value | Description |
|---|---|---|
| tabareaSftTabsTab | 0 | Tab - The tab was clicked, but outside the text or image portion of the tab. |
| tabareaSftTabsText | 1 | Text - The text portion of the tab was clicked. |
| tabareaSftTabsImage | 2 | Image - The image portion of the tab was clicked. |
| tabareaSftTabsImage2 | 3 | Image2 - The second image portion of the tab was clicked. The second image is used to implement tab close buttons, which generate the TabClicked event with a TabArea argument of tabareaSftTabsImage2. |
The TabClicked event occurs when a new tab was clicked and is about to become active. Tab switching only occurs in response to the left mouse button.
While handling the TabClicked event, the application can suppress any further handling of the mouse click event by calling the CancelMode method. This suppresses the subsequent Switching and Switched events and prevents tab switching.
This example adds a checkbox to the second tab. Clicking on the checkbox doesn't change the active tab (because of the call to CancelMode), but toggles the checkbox instead.
Private Sub Form_Load()
With SftTabs1.Direct
.Style = styleSftTabsModernTop
.Tab(1).Image.Appearance = sftImageCheckboxNo
End With
End Sub
Private Sub SftTabs1_TabClicked(ByVal DblClick As Boolean, ByVal TabClicked As Integer, ByVal TabArea As SftTabsLib70.SftTabsTabAreaConstants)
With SftTabs1.Direct
If TabArea = tabareaSftTabsImage Then
If .Tab(TabClicked).Image.Appearance = sftImageCheckboxNo Then
.Tab(TabClicked).Image.Appearance = sftImageCheckboxYes
.CancelMode
ElseIf .Tab(TabClicked).Image.Appearance = sftImageCheckboxYes Then
.Tab(TabClicked).Image.Appearance = sftImageCheckboxNo
.CancelMode
End If
End If
End With
End Sub
Set img = tb.Image
SftTabs1.BulkUpdate = True
img.Clear
img.Appearance = sftImageCheckboxYes
tb.Align = alignSftTabsLeft
SftTabs1.BulkUpdate = False
End Sub
Private Sub SftTabs1_TabClicked(ByVal DblClick As Boolean, ByVal TabClicked As Integer, ByVal TabArea As SftTabsLib70.SftTabsTabAreaConstants)
' a tab has been clicked
' check if a checkbox was clicked. If so, toggle it and prevent tab switching
If TabArea = tabareaSftTabsImage Then
Dim tb As SftTabsTab
Set tb = SftTabs1.Tab(TabClicked)
If tb.Image.Appearance = sftImageCheckboxYes Then
tb.Image.Appearance = sftImageCheckboxNoSee Also SftTabs Object | Object Hierarchy