ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Tab control
  • Overview
  • Opening a dynamic tab pane
  • Opening a tab pane via the "+" button
  • Opening a tab pane using TabOpen
  • Tip: Offer a "Menu" pane allowing the user to choose the type of pane to be created
  • Handling a dynamic tab pane
  • Changing the active dynamic tab pane
  • Getting the text of the active dynamic tab pane
  • Retrieving the name of the internal window displayed in a pane
  • Access the content of the internal window displayed in a pane
  • Properties specific to Tab controls
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
WINDEV allows you to programmatically manipulate Dynamic Tab controls with the TabXXX functions and multiple WLanguage properties. You can also use the Tab control variable directly in the code.
Please note Static tab panes and dynamic tab panes are not identified in the same way:
  • static tab panes are identified by the number of the active pane.
  • dynamic tab panes are identified by the alias of the active pane.
Note When the internal window manipulated in the dynamic tab uses HFSQL data files, it is important that the internal window uses an independent HFSQL context.
Opening a dynamic tab pane
There are different methods to open a dynamic tab pane:
  • via the "+" button of the Tab control. In this case, the options specified in the Tab control description window are taken into account.
  • programmatically with TabOpen.

Opening a tab pane via the "+" button

To open a tab pane via the "+" button in the Tab control:
  1. In the Tab control description window, go to the "Details" tab and check "With 'New' button (+)", then select the internal window in "Internal window when (+) is clicked" and specify the default text of the new tab.
  2. The internal window opened by the "+" button can be:
    • a specific internal window (e.g. a customer form).
      When the user clicks the "+" button, the new tab panes will be identical. They will be based on the same internal window.
      Note: If the internal window is expecting parameters, it is necessary to open the tab pane by programming with the TabOpen function..
    • no internal window.
      In this case, the internal window to open must be specified programmatically. To do so, use TabOpen in the "Create a tab" event of the Tab control (see Opening a tab pane using TabOpen).
Note: The "+" button on the dynamic tab automatically calls the "Pane creation" event in the Tab Control. If this event uses TabOpen, this event will take priority over the internal window specified in the interface.

Opening a tab pane using TabOpen

You can also use TabOpen to open a tab pane.
This function can for example:
  • be used in a button to open an additional tab pane in a Tab control.
  • be used in the "Create a tab" event of the Tab control.
TabOpen is used to:
  • Get the alias of the tab pane. This alias allows you to programmatically handle the tab pane. This alias is also returned by the Value and Alias properties.
  • Specify the text of the tab pane.
  • Specify the internal window to open.
  • Pass parameters to the internal window to open.
Example:
Alias_Onglet is string
// Nouvel onglet affichant la fiche du client en cours
Alias_Onglet = TabOpen(ONG_Menu, "Client "+ Client.IDClient, FI_FicheClient, Client.IDClient)
// Modification de l'image du volet d'onglet
ONG_Menu[Alias_Onglet].Image = "NvClient.png"

Tip: Offer a "Menu" pane allowing the user to choose the type of pane to be created

When the "+" button is clicked, a menu can appear to allow the user to choose the type of information to display.
To create this type of interface:
  1. Create a "Menu" internal window. This internal window contains the options for choosing the data to be displayed in the new tab pane. For example, this window can allow the user to display a customer form, an invoice or the list of orders.
  2. In the Tab control description window, go to the "Details" tab.
  3. In "Internal window when (+) is clicked", select the "Menu" internal window.
  4. Validate.
In this case:
  • The user clicks "+" to add a tab.
  • A new tab pane is displayed, containing the menu (internal window created previously).
  • The user chooses from the menu the type of tab pane to be displayed.
  • The current tab pane (the one displaying the menu) is replaced by the selected pane.
Some modifications are required to develop this type of interface:
  • In the click code of the button used to choose the type of tab pane, use ChangeSourceWindow with the following syntax:
    ChangeSourceWindow(<Selected Internal Window>, <Replacement Internal Window>)

    For example:
    // Remplace la fenêtre de choix par une fiche
    ChangeSourceWindow(FI_Choix, FI_Fiche)
  • To handle the new tab, use the following syntax:
    <Window>.<Tab control>[<Window>.<Tab control>]

    For example, to change the text of the active tab:
    FEN_DYNMAIN.ONG_MDI[FEN_DYNMAIN.ONG_MDI].Libellé = "Fiche de " + TimeSys()
Handling a dynamic tab pane
To handle a dynamic tab pane, use the following syntax:
TabControl[TabPaneAlias].PropertyName = PropertyValue
For example:
ONG_MonOnglet[ONG_MonOnglet].Etat = Grayed
Remarks:
  • ControlPane gets the name of the dynamic pane (alias) displaying a specific control.
    // Clic sur bouton "BTN_MAJ"
    MonVolet is Control
    MonVolet <- ControlPane(MySelf)
    MonVolet.Libellé = MonVolet.Libellé + " (Modifié)"
  • The TabStatus function can be used to determine the status of a dynamic tab pane: active, floating, non-existent, etc.
  • To get the aliases of the active dynamic tabs, simply call EnumControl on the Tab control:
    // Remplir un champ Combo avec la liste des champs de la fenêtre
    i is int = 1
    ResChamp is string
    ResChamp = EnumControl(ONG_MonOnglet, i)
    WHILE ResChamp <> ""
    	i++
    	Trace(ResChamp)
    	ResChamp = EnumControl(ONG_MonOnglet, i)
    END
Handling a group of fields in a dynamic (detachable) pane
Behavior change:
  • Before version 2025 Update 2, manipulating a field group from a tab's internal window also assigned all field groups of the same name present in the window displaying the tab, or in other dynamic tabs.
  • As of version 2025 Update 2, manipulating a group of fields from a tab's internal window assigns only the current internal window. If other field groups with the same name are present in the main window, these field groups will not be modified.
Example: The FEN_Principal window contains the GRP_Buttons field group, and the internal window used in the FI_Visu dynamic pane also contains a GRP_Buttons field group. The GRP_Buttons field group is made invisible in the code of the FI_Visu internal window.
  • Prior to version 2025 Update 2, the window field group and the internal window field group are made invisible.
  • From version 2025 Update 2, only the internal window field group is made invisible.
Changing the active dynamic tab pane
The last created dynamic tab pane is enabled by default. The active tab can be changed programmatically.
To activate a dynamic tab pane:
  • Assign the Tab control the alias of the dynamic tab pane to activate:
    Tab control name = AliasOfTabPane
  • Use the Value property.
Reminder: To activate a static tab pane, simply enter the number of the pane to be activated.
Tab control name = Pane number
Getting the text of the active dynamic tab pane
To get the text of the active tab, simply use the Caption property on the tab pane (identified by its alias).
For example:
AliasOnglet1 is string = TabOpen(ONG_Test, "Mon onglet 1", "FI_FenêtreInterne")
Trace(ONG_Test[AliasOnglet1].Libellé)
The Caption property can also be used to change the text of the tab pane.
Retrieving the name of the internal window displayed in a pane
To retrieve the name of the internal window displayed in a dynamic pane, you can use the following code:
// Récupère le volet affiché 
oFenInterne is Control <- ONG_Test[AliasVolet1]

// Récupère la fenêtre interne associée au volet
sNomFenêtreInterne is string
sNomFenêtreInterne = EnumControl(oFenInterne, 1, byCreationOrder)
Access the content of the internal window displayed in a pane
indirection operators can be used to access the value of a control or variable in the internal window displayed in a dynamic pane:
// Récupère la valeur d'un champ de la fenêtre interne 
Info({AliasVolet1 + ".NomChamp", indControl})

// Récupère la valeur d'une variable de la fenêtre interne
Info({AliasVolet1 + ".NomVariable", indVariable})

// Appel une procédure de la fenêtre interne
ExecuteProcess(AliasVolet1 + ".pNomProcédure", trtProcedure)

// Equivalent à :
MaProcédure is procedure = gsAlias_Onglet + ".pNomProcédure"
MaProcédure()
It is preferable to use the locals procedures of a window to manipulate its controls, instead of directly accessing the controls and the variables by indirection. This keeps the internal window autonomous and facilitates maintenance.
Properties specific to Tab controls
The following properties are specific to the programmed management of Dynamic Tab Control characteristics.
CaptionIfNewThe CaptionIfNew property gets and sets the caption of a pane opened by the end user in a Dynamic Tab control.
DynamicTabThe DynamicTab property is used to:
  • Find out the type of a Tab control (static tab or dynamic tab).
  • Modify the type of a Tab control (static tab or dynamic tab).
StoreTheConfigurationThe property MemorizeConfiguration property property allows you to:
  • Determine whether the configuration of the panes in a Dynamic Tab control or Ribbon control is automatically saved and restored.
  • Modify the configuration of the panes in a Dynamic Tab control or Ribbon control so that it is automatically saved and restored (or not)
UndockablePaneThe UnlockablePane property is used to:
  • Determine if the end user can move the panes of a Ribbon or Dynamic Tab control outside the window.
  • Allow or prevent the end user from moving the panes of a Ribbon or Dynamic Tab control outside the window.
UndockedThe Undocked property is used to determine if a pane of a Tab or Ribbon control is undocked.
WindowIfNewThe WindowIfNew property gets and sets the name of the internal window to be opened if the end user opens a new tab in a Dynamic Tab control.
WithClosingButtonThe property WithCloseButton property allows you to:
  • Determine whether all the tabs of a Dynamic Tab control have a Close button.
  • Show a Close button in all the tabs of a Dynamic Tab control.
WithNewButtonThe property WithNewButton property allows you to:
  • Determine if a Dynamic Tab control has New tab button (+).
  • Configure a Dynamic Tab control to show a New tab button.
For a complete list of WLanguage properties that can be used with Tab controls, see Tab control properties.
Related Examples:
WD Multi-Windowing Training (WINDEV): WD Multi-Windowing
[ + ] This example presents the basic concepts for managing the multi-windowing and the dynamic tabs with WINDEV.

This example includes a simple interface for managing the customer forms:
- multi-windowing with MDI interface,
- multi tabs with a dynamic tab control.
Minimum version required
  • Version 20
Comments
Click [Add] to post a comment

Last update: 04/04/2025

Send a report | Local help