PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Handling the Dashboard control by programming
  • Adding a Widget
  • Running a procedure defined for an internal window or page (used in Widget)
  • Handling a Widget by programming
  • Drag and Drop of a Widget to a Dashboard control
  • Properties specific to the Dashboard controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
To handle a Dashboard control by programming, WINDEV, WEBDEV and WINDEV Mobile propose the functions for dashboard management.
This help page explains how to handle a Dashboard control by programming.
Linux Note: The Dashboard control is available in Linux in the Linux WEBDEV sites only. The Dashboard control is not available in the WINDEV applications for Linux.
Versions 22 and later
Android This feature is now available for the Android applications.
iPhone/iPad This feature is now available for the iPhone/iPad applications.
New in version 22
Android This feature is now available for the Android applications.
iPhone/iPad This feature is now available for the iPhone/iPad applications.
Android This feature is now available for the Android applications.
iPhone/iPad This feature is now available for the iPhone/iPad applications.
Handling the Dashboard control by programming

Adding a Widget

Adding Widgets into a Dashboard control is performed by DashAddWidget. This function is used to add a Widget. This Widget is invisible by default. It can be displayed by using ..Visible. If the Widget is not made visible directly, the user can make it visible via the popup menu of the edit mode.
Examples:
  • Adding a simple Widget (without parameters):
    // Adds a simple Widget
    nSubscript = DashAddWidget(DASH_Dashboard, IW_Widget_StockAlert, ...
    "Stock alert")
  • Adding a Widget with parameters:
    nSubscript is int

    // Adds a widget that expects parameters
    nSubscript = 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[nSubscript]..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 into 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 by programming when loading the Dashboard control, all you have to do is use:
Caution: In this case, these functions must necessarily be used in the initialization process of Dashboard control.
Examples:
  • Adding a simple Widget (without parameters)
    // -- Initialize the DASH_Dashboard control
    // - stock alert
    // Adds the widget
    nSubscript = DashAddWidget(MySelf, IW_Widget_StockAlert, "Stock alert")
    // Configures the widget (placed on the left)
    DashInitialConfiguration(MySelf, nSubscript, 5, 1)
  • Adding a widget with parameters
    // -- Initialize the DASH_Dashboard control

    dDate is Date
    nSubscript is int
    nX, nY are int

    // Adds information into the initial configuration:
    // - key numbers for the last 3 months
    nX = 1 ; nY = 3
    FOR i = 1 TO 3
    // Adds the widget
    nSubscript = DashAddWidget(MySelf, IW_Widget_KeyNumber, ...
    StringBuild("Key numbers for %1", ...
    DateToString(dDate, "Mmm YYYY")), dDate)
    // Configures the widget (placed on the left)
    DashInitialConfiguration(MySelf, nSubscript, nX, nY)
    // The next one will be lower
    nY++
    dDate..Month--
    END
Note: To refresh a Widget with parameters, we advise you to:
  • Add an optional process for refreshing the Widget in the processes 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 in Widget)

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

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

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

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

    For example:
    X is Control <-DASH_Dashboard[4]
    Trace(X..Caption)
The properties that can be used on the Widgets are identical to the ones that can be used on internal windows or pages. See Properties associated with the internal windows and Properties associated with the internal pages for more details.
Drag and Drop of a Widget to a Dashboard control
WINDEV WINDEV allows you to perform a programmed Drag and Drop from an Image control, List Box control, Looper control, ... to a Dashboard control.
The different steps are as follows:
  1. Declare that the Dashboard control is target of Drag and Drop.
    This declaration is performed in the initialization code of the control via ..DndTarget.
    Example:
    // -- Initialize DASH_Dashboard
    // Allows Drag and Drop
    MySelf..DndTarget = dndAuto
  2. Declare the source control as source of Drag and Drop.
    In the initialization code of the source control, declare that the control is source of Drag and Drop with ..DndSource.
    Example:
    // The image is source of Drag and Drop
    MySelf..DndSource = dndProgram
  3. Define the procedure for the beginning of drag (in the initialization code of the Source control for example).
    Example:
    // Defines a procedure for "begin drag"
    // This procedure is using DnDCacheDashElement
    // to define the widget to drop
    DnDEvent(onDndBegin, MySelf, dndBeginDrag)
  4. Type the code of the procedure.
    Example:
    PROCEDURE onDndBegin()

    // Define the widget to drop according to the source control
    SWITCH _DND.SourceControl
    // Indicates that the drop on the Dashboard control
    // must add the "Clock" widget
    // by using the "IW_Widget_Clock" internal window
    CASE IMG_Widget_Calendar..Name
    DnDCacheDashElement(IW_Widget_Calendar, "Clock")

    OTHER CASE
    Error("Only the IMG_Widget_Calendar image" + ...
    "is allowed for Drag and Drop")
    END
Properties specific to the Dashboard controls
The following properties are used to manage a Dashboard control by programming.
Versions 18 and later
CompactOption
New in version 18
CompactOption
CompactOption
..CompactOption 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.
Versions 17 and later
ElementHeight
New in version 17
ElementHeight
ElementHeight
..ElementHeight 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.
Versions 17 and later
ElementWidth
New in version 17
ElementWidth
ElementWidth
..ElementWidth 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.
Versions 19 and later
MarginHeight
New in version 19
MarginHeight
MarginHeight
..MarginHeight 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.
Versions 19 and later
MarginWidth
New in version 19
MarginWidth
MarginWidth
..MarginWidth 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.
To find out the entire list of WLanguage properties that can be used with a Dashboard control, see Properties associated with the Dashboard control.
Minimum required version
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment