Tab Folder - TabChanging Event
TabChanging happens just before a tab is displayed
Member of Tab Folder (PRIM_TAB)
Parameters
Name | Type | Data Type | Description |
|---|---|---|---|
OpenPage | *Input | OpenPage is the tab sheet currently open | |
OpeningPage | *Input | Reference to the opening page | |
CanChangePage | *Both | Boolean | Set to false to prevent the change of page |
Details
The TabChanging event is fired the user clicks on a different tab.
The CanChangePage property can be used to prevent a change of tab sheet.
This only applies to tabs in the Center DockPosition.
Example
In this example, the caption of the opening page is shown in the form caption.
The user is prevented from ever turning to Page2.
Begin_Com Role(*EXTENDS #PRIM_FORM) Caption('Docking Framework Sample') Clientheight(454) Clientwidth(912) Height(493) Left(188) Top(205) Width(928) Layoutmanager(#TableLayout1)
Define_Com Class(#PRIM_TBLO) Name(#TableLayout1)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column1) Displayposition(1) Parent(#TableLayout1)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row1) Displayposition(1) Parent(#TableLayout1)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem1) Column(#Column1) Manage(#Tab1) Parent(#TableLayout1) Row(#Row1)
Define_Com Class(#PRIM_TAB) Name(#Tab1) Bottomlayoutpriority(4) Componentversion(2) Displayposition(1) Height(454) Left(0) Leftlayoutpriority(1) Parent(#COM_OWNER) Rightlayoutpriority(2) Tabposition(1) Top(0) Toplayoutpriority(3) Width(912)
Define_Com Class(#PRIM_TBSH) Name(#Sheet1) Caption('Page1') Displayposition(1) Height(430) Left(0) Parent(#Tab1) Tabposition(1) Tabstop(False) Top(24) Width(912)
Define_Com Class(#PRIM_TBSH) Name(#Sheet2) Caption('Page2') Displayposition(2) Height(430) Left(0) Parent(#Tab1) Tabposition(2) Tabstop(False) Top(24) Width(912)
Define_Com Class(#PRIM_TBSH) Name(#Sheet3) Caption('Page3') Displayposition(3) Height(430) Left(0) Parent(#Tab1) Tabposition(3) Tabstop(False) Top(24) Width(912)
Evtroutine Handling(#Tab1.TabChanging) Openingpage(#OpeningPage) Canchangepage(#CanChangePage)
#com_owner.Caption := #OpeningPage.caption
#CanChangePage := (#OpeningPage *IsNotEqualTo #Sheet2)
Endroutine
End_Com