|
- Overview
- Opening a dynamic tab pane
- Opening a tab pane via the "+" button
- Opening a tab pane via TabOpen
- Tip: Proposing a "Menu" pane allowing the user to choose the type of pane to create
- Handling a dynamic tab pane
- Changing the active dynamic tab pane
- Finding out the caption of 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 the Tab controls
Handling a dynamic tab by programming
WINDEV allows you to handle the dynamic Tab controls by programming with the TabXXX functions and with several WLanguage properties. You also have the ability to handle a dynamic Tab control by programming. To do so, use the variable of the Tab control in the code. Caution: The static tab panes and the dynamic tab panes are not identified the same way: - the static tab panes are identified by the number of the active pane.
- the dynamic tab panes are identified by the alias of active pane.
Remark: When the internal window handled in the dynamic tab is using HFSQL data files, the internal window must use an independent HFSQL context. Opening a dynamic tab pane Several methods can be used to open a dynamic tab pane: - via the "+" button of Tab control. In this case, the options specified in the description window of Tab control are taken into account.
- by programming, via TabOpen.
Opening a tab pane via the "+" button To open a tab pane via the "+" button found in the Tab control: - In the description window of Tab control, "Details" tab, check "With "New" button" and specify the "Internal window in creation" and the "Default caption of new pane".In the description window of Tab control, "Details" tab, check "With "New" button (+)" and specify the "Internal window on New button (+)" and the "Default caption of new pane".
- The internal window opened by the "+" button can be:
- a specific internal window (adding a customer form for example).
When the user clicks the "+" button, the created tab panes will be identical, based on the same internal window. Remark: If the internal window expects parameters, the tab pane must be opened by programming with TabOpen. - no internal window.
In this case, the internal window to open must be specified by programming. To do so, TabOpen must be used in the event "Creating a pane" of the Tab control (see Opening a tab pane via TabOpen).
Remark: The "+" button of the dynamic tab automatically calls the event "Creating a pane" of 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 via TabOpen To open a tab pane, you also have the ability to use 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 event "Creating a pane" of the Tab control.
- Finding out the alias of tab pane. This alias is used to handle the tab pane by programming. This alias is also returned by ..Value or by ..Alias.
- Specify the caption of tab pane.
- Specify the internal window to open.
- Pass parameters to the internal window to open.
Example:
Alias_Tab is string // New tab displaying the form of current customer Alias_Tab = TabOpen(TAB_Menu, "Customer "+ Customer.CustomerID, IW_CustomerForm, Customer.CustomerID) // Modify the image of tab pane TAB_Menu[Alias_Tab]..Image = "NewCust.png"
Tip: Proposing a "Menu" pane allowing the user to choose the type of pane to create During the click on the "+" button, some interfaces can propose a menu allowing the user to choose the type of information to display. To develop this type of interface, all you have to do is create an internal window named "Menu". For example, this window can allow the user to display a customer form, an invoice or the list of orders. In this case, the user chooses the type of tab pane to create and the current tab pane 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 pane, use ChangeSourceWindow with the following syntax:
ChangeSourceWindow(<Selected Internal Window>, <Replacement Internal Window>)
For example:
// Replaces the choice window by a form ChangeSourceWindow(IW_Choice, IW_Form)
- To handle the added tab, use the following syntax:
<WindowName>.<TabName>[<WindowName>.<TabName>]
For example, to modify the caption of the opened 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:
NameTabControl[AliasOfTabPane]..PropertyName = PropertyValue
For example:
TAB_MyTab[TAB_MyTab]..State = Grayed
Remarks: - ControlPane is used to find out 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)"
- TabStatus is used find out the status of a dynamic tab pane: active, floating, not found.
- To find out the aliases of the open dynamic panes, simply call EnumControl on the Tab control:
// Fill 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
Changing the active dynamic tab pane The last created dynamic tab pane is enabled by default. The current tab can be changed by programming. To enable a dynamic tab pane: - Assign the tab with the alias of dynamic tab pane to enable:
Tab control name = AliasOfTabPane
- Use ..Value.
Reminder: To enable a static tab pane, all you have to do is specify the number of the pane to enable.
Finding out the caption of active dynamic tab pane To retrieve the caption of the active tab, call ..Caption on the tab pane (identified by its alias). For example:
AliasTab1 is string = TabOpen(TAB_Test, "My tab 1", "IW_InternalWindow") Trace(TAB_Test[AliasTab1]..Caption)
..Caption can also be used to modify the caption of the tab pane. Retrieving the internal window displayed in a pane To get the name of internal window displayed in a dynamic pane, you have the ability to 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 the Tab controls The following properties are used to manage the characteristics of a dynamic Tab control by programming.
| | CaptionIfNew | ..CaptionIfNew is used to find out and modify the caption of the new pane opened by the end user in a dynamic Tab control. | DynamicTab | ..DynamicTab 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 | ..StoreTheConfiguration is used to: - Find out whether the configuration of the panes in a dynamic Tab control is automatically saved and restored.
- Modify the configuration of the panes in a dynamic Tab control so that it is automatically saved and restored (or not).
| UndockablePane | ..UndockablePane is used to: - Find out whether the panes of a dynamic Tab control can be moved outside the window by the end user.
- Allow (or not) the panes of a dynamic Tab control to be moved outside the window by the end user.
| WindowIfNew | ..WindowIfNew is used to find out and modify the name of internal window to open if the end user opens a new pane in a dynamic Tab control. | WithClosingButton | ..WithClosingButton is used to: - Find out whether all panes of a dynamic tab include a closing cross.
- Configure all panes of a dynamic tab in order to display a closing cross.
| WithNewButton | ..WithNewButton is used to: - Find out whether a dynamic Tab control proposes an addition cross.
- Configure a dynamic Tab control so that it proposes (or not) an addition cross.
|
Related Examples:
|
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.
|
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |