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
  • Naming tab panes
  • Handling a tab pane
  • Changing the active tab pane
  • Remarks
  • Identifying the active tab pane
  • Tab pane number
  • Tab pane text
  • WLanguage functions for manipulating Tab controls
  • 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
Manipulating Tab controls programmatically
Overview
WINDEV, WINDEV Mobile and WEBDEV allow you to manipulate a Tab control programmatically. To do so, use the variable of the Tab control in the code.
The variable of the Tab control corresponds to the number of the active pane. This variable is an integer. This number is allocated when the tabs are described: in the tab list, the first tab is numbered 1, the second 2, etc.
You can also name the tab panes (in the "General" tab of the control description window). In this case, you can directly enter the tab name to manipulate it.
Remark: Switching from one tab to another (when the user clicks on a tab) is automatically managed.
Naming tab panes
From version 26, you can name tab panes. These (optional) names make it easier to manipulate tabs in the code. Unnamed tabs are handled via their index. If the index changes (when a tab is moved, inserted, etc.), all the WLanguage code must be revised to take this change into account.
Tab naming simplifies these operations: the name of the tab pane is given in the "General" tab of the control description window.. It can then be used in the code to designate the pane to handle. You can move or insert tabs without having to check all the existing code.
Handling a tab pane
To handle a tab pane via WLanguage properties, use the following syntax:
  • Tab not named: tab is identified by its number. The number is allocated when the tabs are described: in the tab list, the first tab has the number 1, the second has the number 2., ...
    Tab_Field_Name[Tab_Field_Number].PropertyName = PropertyValue

    For example:
    TAB_MyTab[2].State = Grayed
  • Tab pane named: The tab pane is identified by the name specified in the "General" tab of the control description window..
    Tab_Name.PropertyName = PropertyValue

    For example, if the tab pane is named "Search":
    Search.State = Grayed
Note: To use properties on a field, you can either use the syntax <Nom du champ>.PropertyName or the syntax <Nom du champ>..PropertyName.
Changing the active tab pane
The tab pane #1 (the most on the left) is enabled by default. The active tab can be changed programmatically.
To enable a tab pane:
  • Unnamed tab pane: Assign the tab with the number of the tab pane to be activated:
    Name_Tab_Control = Number_Of_Tab_Pane
  • Tab pane named: Assign the tab with the name of the tab pane to be activated:
    Name_Tab_Control = Tab_Pane_Name
  • Use the Value property.

Remarks

  • If the specified tab pane does not exist, the displayed tab pane is not changed.
  • On a single Tab control, only one tab can be displayed at a time.
  • When changing tab pane:
    • the output code of the field in focus is executed.
    • the entry code for the first control in input mode in the tab pane is activated.
Identifying the active tab pane

Tab pane number

To get the number of the active tab pane:
  • perform a simple assignment. For example:
    NumActivePane = NameTabControl
  • In the case of a shutter named:
SWITCH NameTabControl

CAS Search: //Name active search tab
CAS Edition: //Tab named Edit active

END
WINDEVWindowsJava

Tab pane text

To get the text of the active tab pane, simply use the Caption property on the tab pane:
For example:
  • unnamed tab:
    Trace(TAB_Tab1[TAB_Tab1].Caption)
  • unnamed tab:
    Trace(Search.Caption)
The Caption property can also be used to change the text of the tab pane.
WLanguage functions for manipulating Tab controls
The following functions are specific to the programmed management of Tab Control characteristics.
ControlCloneClone a tab pane.
ControlTabIdentify the name of the Tab control associated with a control.
EnumControlEnumerate the controls associated with a tab.
EnumSubElementEnumerate the panes of a tab.
Properties specific to Tab controls
The following properties are specific to the programmed management of Tab Control characteristics.
CountShows the number of panes in a tab.
ImageUsed to find out and modify the image associated with a tab pane or with a tab.
To manipulate the tab pane, use the following syntax: <Champ Onglet> [<Indice du volet>].


For a complete list of WLanguage properties that can be used with Tab controls, see Tab control properties.
See also
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/30/2024

Send a report | Local help