PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD20] How to tell if a Dashboard widget is shown or hidden
[WD20] How to tell if a Dashboard widget is shown or hidden
Iniciado por guest, 28,may. 2015 18:39 - 8 respuestas
Publicado el 28,mayo 2015 - 18:39
Is there a way to list the visible widgets in a dashboard control or a way to tell if a single widget is shown or hidden?

Functions I've tried:
WinStatus() - Always returns Not Found. Must not play nice with internal windows.

I tried these hoping it would return 0/null if the window wasn't found, but they error out.
WinInXPos()
WinOutXPos()
WinStatus
Publicado el 28,mayo 2015 - 19:03
Hi, a widget is basically an internal window. I didn't try but I'd say that all procedures to detect an open MDI-window will work on the widgets as well.
Publicado el 28,mayo 2015 - 19:13
MDIEnumChild() returns no results unfortunately.
Publicado el 28,mayo 2015 - 19:22
Curtis
DashCount() may be your friend - I have not tried it.

From the Help (v20)
Example // Displays the number of widgets displayed and the total number of widgets InfoBuild("The dashboard contains %1 widgets among which %2 are displayed", ... DashCount(DASH_Dashboard, toTotal), DashCount(DASH_Dashboard, toShown))
Publicado el 28,mayo 2015 - 19:24
If they are internal windows did you check if the internal windows control is visible or not?
Publicado el 28,mayo 2015 - 19:26
I also just found DashCount Derek. I think that might be my best option. Get a DashCount(). Loop through each widget subscript and check the ..caption to see if the widget is visible.
Publicado el 28,mayo 2015 - 21:24
That won't work either.

If I have 4 widgets in a row and the second one is hidden, this code will get the captions of the first three widgets instead of the first three visible widgets. If I change ..Caption to ..Visible arrWidgets is filled with all ones although the second one should be 0.

arrWidgets is array of string
FOR i = 1 _TO_ DashCount(DASH_Chart,toShown)
ArrayAdd(arrWidgets,DASH_Chart..Caption)
END
Publicado el 28,mayo 2015 - 22:34
I think I'll be able to do it with global booleans. Set a global boolean to false for each chart. At end of init for each chart set the corresponding boolean to true. Before executing a charts code check for a true boolean. When hiding a widget(DeleteWidget process) set the boolean back to false.
Publicado el 29,mayo 2015 - 04:13
Hello Curtis,

Try This:

DoesWidgetsExist(sWIn is string) //See how many are in the dashboard control nCnt is int = DashCount(DASH_SalesHome,toTotal) //loop thru all the dash widgets find out who is here FOR i = 1 TO nCnt IF DASH_SalesHome..Name = sWIn THEN RESULT = True BREAK ELSE RESULT = False END END DW