![]() | Type | Description | ||
| NewActive as Long | A long expression that indicates the position of page being activated | |||
| OldActive as Long | A long expression that indicates the position of page being deactivated |
The Activate event is fired when user changes the focused page. Use the Activate event to notify your application when a new page is activated. Use the Active property to change programmatically the focused page. For instance, the following sample changes the way how the caption of the focused page is displayed:
Private Sub Tab1_Activate(ByVal NewActive As Long, ByVal OldActive As Long) With Tab1.Pages If Not (OldActive = NewActive) Then .Item(OldActive).Caption = .Item(OldActive).UserData End If .Item(NewActive).UserData = .Item(NewActive).Caption .Item(NewActive).Caption = "<b><fgcolor=0000FF><u>" & .Item(NewActive).UserData & "</b>" End With End Sub
The Activate handler applies built-in HTML format to focused page. The Activate handler saves the page's caption to UserData property before changing it, to restore the caption when the focused page is deactivated. Also, it is recommended calling the Tab1_Activate method when your form is loaded, because the Activate handler is not called right after form is loaded like in the following sample:
Private Sub Form_Load() Tab1_Activate Tab1.Active, Tab1.Active End Sub