|
|
|
|
|
- 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
- Know the label of the active dynamic tab pane
- Retrieving the internal window displayed in a pane
- Access the content of the internal window displayed in a pane
- Properties specific to Tab controls
Handling a dynamic tab through programming (prefix syntax)
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 <Tab>.Open.
Opening a tab pane via the "+" button To open a tab pane via the "+" button in the Tab control: - 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.
- 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 <Tab>.Open function.. - no internal window.
In this case, the internal window to open must be specified programmatically. To do so, use <Tab>.Open 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 <Tab>.Open, this event will take priority over the internal window specified in the interface. Opening a tab pane using TabOpen 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.
- 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_Tab is string // New tab containing the form of the current customer Alias_Tab = TAB_Menu.Open("Customer "+ Customer.CustomerID, IW_CustomerForm, Customer.CustomerID) // Change the image of the tab pane TAB_Menu[Alias_Tab]..Image = "NewCust.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: - 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.
- In the Tab control description window, go to the "Details" tab.
- In "Ventana interna al hacer clic en Nuevo (+)", select the "Menu" internal window.
- 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 <Internal window>.ChangeSourceWindow with the following syntax:
ChangeSourceWindow(<Selected Internal Window>, <Replacement Internal Window>) For example:
ChangeSourceWindow(IW_Choice, IW_Form)
- 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:
WIN_DYNHAND.TAB_MDI[WIN_DYNHAND.TAB_MDi].Caption = "Form " + SysTime()
Handling a dynamic tab pane To handle a dynamic tab pane, use the following syntax: TabControl[TabPaneAlias].PropertyName = PropertyValue For example: TAB_MyTab[TAB_MyTab].State = Grayed
Remarks: - ControlPane gets the name of the dynamic pane (alias) displaying a specific control.
// Click on "BTN_UPD" button MyPane is Control MyPane <- ControlPane(MySelf) MyPane.Caption = MyPane.Caption + " (Modified)"
- The <Tab>.Estado 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:
// Populate a Combo Box control with the list of controls in the window i is int = 1 ResControl is string ResControl = EnumControl(TAB_MyTab, i) WHILE ResControl <> "" i++ Trace(ResControl) ResControl = EnumControl(TAB_MyTab, 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 Know the label 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:
AliasTab1 is string = TAB_Test.TabOpen("My tab 1", "IW_InternalWindow") Trace(TAB_Test[AliasTab1].Caption)
The Caption property can also be used to change the text of the tab pane. Retrieving 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:
// Retrieves the displayed pane oInternalWin is Control <- TAB_Test[PaneAlias1] // Retrieves the internal window associated with the pane sInternalWindowName is string sInternalWindowName = EnumControl(oInternalWin, 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: // Retrieves the value of a control in the internal window Info({PaneAlias1 + ".ControlName", indControl}) // Retrieves the value of a variable in the internal window Info({PaneAlias1 + ".VariableName", indVariablel}) // Call a procedure of the internal window ExecuteProcess(PaneAlias1 + ".pProcédureName", trtProcedure) // Equivalent to: MyProcedure is procedure = gsAlias_Tab + ".pProcedureName" MyProcedure()
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.
| | CaptionIfNew | La propiedad CaptionIfNew obtiene y establece el título de un panel abierto por el usuario final en un control Pestaña dinámica. | DynamicTab | The 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).
| StoreTheConfiguration | The StoreTheConfiguration property is used 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)
| UndockablePane | La propiedad UnlockablePane se utiliza para: - Determinar si el usuario final puede mover los paneles de un control Pestaña dinámica o Cinta de opciones fuera de la ventana..
- Permitir o impedir que el usuario final mueva los paneles de un control Cinta o Pestaña dinámica fuera de la ventana..
| Undocked | La propiedad Undocked se utiliza para determinar si un panel de un control Pestaña o Cinta está desacoplado. | WindowIfNew | La propiedad WindowIfNew obtiene y establece el nombre de la ventana interna que se abrirá si el usuario final abre una nueva pestaña en un control Pestaña dinámica. | WithClosingButton | La propiedad WithClosingButton permite: - Determinar si todas las pestañas de un control Pestaña dinámica tienen un botón Cerrar.
- Mostrar un botón Cerrar en todas las pestañas de un control Pestaña dinámica.
| WithNewButton | La propiedad WithNewButton permite: - Determinar si un control Pestaña dinámica tiene un botón Nueva pestaña (+).
- Configurar un control Pestaña dinámica para que muestre un botón Nueva pestaña.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|