Hide

SftTabs/OCX 6.5 - Tab Control for VB6

Display
Print

SftTabs.TabClicked Event

A new tab was clicked and is about to become active.

Syntax

VBPrivate 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.

NameValueDescription
tabareaSftTabsTab0Tab - The tab was clicked, but outside the text or image portion of the tab.
tabareaSftTabsText1Text - The text portion of the tab was clicked.
tabareaSftTabsImage2Image - The image portion of the tab was clicked.
tabareaSftTabsImage23Image2 - 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.

Comments

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.

Example

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 SftTabsLib.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

See Also SftTabsEvents Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.