ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Dashboard control
  • Overview
  • Manipulating Dashboard controls programmatically
  • Adding a widget
  • Running a procedure defined for an internal window or page (used as widget)
  • Handling a widget programmatically
  • Dragging and dropping widgets onto a Dashboard control
  • Properties specific to Dashboard controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
To programmatically handle a Dashboard control, WINDEV, WEBDEV and WINDEV Mobile include dashboard-specific functions.
This help page explains how to programmatically manipulate Dashboard controls.
Manipulating Dashboard controls programmatically

Adding a widget

Widgets can be added to Dashboard controls using DashAddWidget. By default, a Widget is invisible. It can be displayed by using the Visible property. If the widget is not visible, the user can make it visible via the context menu of the edit mode.
Examples:
  • Adding a simple widget (without parameters):
    // Adds a simple widget
    nIndex = DashAddWidget(DASH_Dashboard, IW_Widget_StockAlert, ...
    "Stock alert")
  • Adding a widget with parameters:
    nIndex is int
     
    // Adds a widget that expects parameters
    nIndex = DashAddWidget(DASH_Dashboard, IW_Widget_Clock, ...
    "Clock" + COMBO_AddWidget[COMBO_AddWidget].DisplayedValue, ...
    COMBO_AddWidget[COMBO_AddWidget].DisplayedValue)
     
    // Displays this widget upon request
    IF YesNo(Yes, "Do you want to display this widget?") = Yes THEN
    DASH_Dashboard[nIndex].Visible = True
    ELSE
    ToastDisplay("Widget added to the dashboard as ""hidden"". "+ ...
    "Switch to edit mode to add it", toastShort, vaMiddle, haCenter)
    END
Special case: adding a widget to the initial configuration
By default, the Dashboard control displays the widgets as they have been defined in the window or page editor.
To add widgets programmatically when the Dashboard control is loaded, use:
Caution: In this case, these functions must be used in the initialization event of the Dashboard control.
Examples:
  • Adding a simple widget (without parameters)
    // -- Initialize the DASH_Dashboard control
    // - stock alert
    // Adds the widget
    nIndex = DashAddWidget(MySelf, IW_Widget_StockAlert, "Stock alert")
    // Configures the widget (placed on the left)
    DashInitialConfiguration(MySelf, nIndex, 5, 1)
  • Adding a widget with parameters
    // -- Initialize the DASH_Dashboard control
     
    dDate is Date
    nIndex is int
    nX, nY are int
     
    // Adds information to the initial configuration:
    // - key numbers for the last 3 months
    nX = 1 ; nY = 3
    FOR i = 1 TO 3
    // Adds the widget
    nIndex = DashAddWidget(MySelf, IW_Widget_KeyNumber, ...
    StringBuild("Key numbers for %1", ...
    DateToString(dDate, "Mmm YYYY")), dDate)
    // Configures the widget (placed on the left)
    DashInitialConfiguration(MySelf, nIndex, nX, nY)
    // The next one will be lower
    nY++
    dDate.Month--
    END
Remark: To refresh a widget with parameters, it is recommended to:
  • Add an optional event for refreshing the widget in the events of the internal window or page.
  • Enter the code used to refresh the widget. This code can be used for example to update the elements displayed in the internal window or page.
  • Refresh the widget with DashDisplay.

Running a procedure defined for an internal window or page (used as widget)

To run a procedure defined in the internal window or page used as Widget, use the following syntaxes:
  • Syntax that uses the name of the internal window or page:
    NameInternalWindow.ProcedureName(Param1, Param2, ...)

    For example:
    IW_Widget_KeyNumber.NewDate(EDT_Date)
  • Syntax that uses a Control variable (if the same internal window or page is used several times in the Dashboard control):
    VariableName is Control <- DashboardName[WidgetIndex]
    VariableName.ProcedureName(Param1, Param2, ...)

    For example:
    X is Control <-DASH_Dashboard[4]
    X.NewDate(EDT_Date)
Handling a widget programmatically
To programmatically handle a widget, use one of the following syntaxes:
  • Syntax 1: Direct use of the Dashboard control:
    DashboardName[WidgetIndex]

    For example:
    Trace(DASH_MyDashboard[1].Caption)
  • Syntax 2: Using a Control variable :
    VariableName is Control <- DashboardName[WidgetIndex]

    For example:
    X is Control <-DASH_Dashboard[4]
    Trace(X.Caption)
The properties that can be used on widgets are identical to those that can be used on internal windows or pages. For more details, see Properties associated with the internal windows and Properties associated with the internal pages.
Dragging and dropping widgets onto a Dashboard control
Properties specific to Dashboard controls
Use the following properties to programmatically manipulate Dashboard controls.
CompactOptionThe CompactOption property is used to:
  • find out whether the options found in a Check Box, Radio Button or Dashboard control are in compacted mode.
  • switch the options found in a Check Box, Radio Button or Dashboard control to compacted mode.
ElementHeightThe ElementHeight property is used to:
  • Find out or modify the height of the elements in an Organization Chart control.
  • Find out or modify the height of the cells in a Dashboard control.
ElementWidthThe ElementWidth property is used to:
  • Find out or modify the width of the elements in an Organization Chart control.
  • Find out or modify the width of the cells in a Dashboard control.
MarginHeightThe MarginHeight property is used to:
  • Find out the vertical margin between the widgets found in a Dashboard control.
  • Modify the vertical margin between the widgets found in a Dashboard control.
MarginWidthThe MarginWidth property is used to:
  • Find out the horizontal margin between the widgets found in a Dashboard control.
  • Modify the horizontal margin between the widgets found in a Dashboard control.
For a complete list of WLanguage properties that can be used with Dashboard controls, see Dashboard control properties.
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/29/2023

Send a report | Local help