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.
Syntax for Activate event, /COM version, on:
private void Activate(object sender, AxEXTABLib._ITabEvents_ActivateEvent e) { } void OnActivate(long NewActive,long OldActive) { } void __fastcall Activate(TObject *Sender,long NewActive,long OldActive) { } procedure Activate(ASender: TObject; NewActive : Integer;OldActive : Integer); begin end; procedure Activate(sender: System.Object; e: AxEXTABLib._ITabEvents_ActivateEvent); begin end; begin event Activate(long NewActive,long OldActive) end event Activate Private Sub Activate(ByVal sender As System.Object, ByVal e As AxEXTABLib._ITabEvents_ActivateEvent) Handles Activate End Sub Private Sub Activate(ByVal NewActive As Long,ByVal OldActive As Long) End Sub Private Sub Activate(ByVal NewActive As Long,ByVal OldActive As Long) End Sub LPARAMETERS NewActive,OldActive PROCEDURE OnActivate(oTab,NewActive,OldActive) RETURN |
<SCRIPT EVENT="Activate(NewActive,OldActive)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function Activate(NewActive,OldActive) End Function </SCRIPT> Procedure OnComActivate Integer llNewActive Integer llOldActive Forward Send OnComActivate llNewActive llOldActive End_Procedure METHOD OCX_Activate(NewActive,OldActive) CLASS MainDialog RETURN NIL void onEvent_Activate(int _NewActive,int _OldActive) { } function Activate as v (NewActive as N,OldActive as N) end function function nativeObject_Activate(NewActive,OldActive) return |
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