Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
9
Erster Beitrag:
vor 3 Jahren
Letzter Beitrag:
vor 3 Jahren
Beteiligte Autoren:
Curtis, DW, Paulo Oliveira, DerekT, GuenterP

[WD20] How to tell if a Dashboard widget is shown or hidden[SOLVED]

Startbeitrag von Curtis am 28.05.2015 16: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

Antworten:

Re: [WD20] How to tell if a Dashboard widget is shown or hidden

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.

von GuenterP - am 28.05.2015 17:03

Re: [WD20] How to tell if a Dashboard widget is shown or hidden

MDIEnumChild() returns no results unfortunately.

von Curtis - am 28.05.2015 17:13

Re: [WD20] How to tell if a Dashboard widget is shown or hidden

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))


von DerekT - am 28.05.2015 17:22

Re: [WD20] How to tell if a Dashboard widget is shown or hidden

If they are internal windows did you check if the internal windows control is visible or not?

von Paulo Oliveira - am 28.05.2015 17:24

Re: [WD20] How to tell if a Dashboard widget is shown or hidden

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.

EDIT: I don't think that's possible Paulo. There internal window isn't in an actual internal window control. It's in a Dashboard control. I tried to check the visibility of the internal window itself, but it errors if it is hidden.

von Curtis - am 28.05.2015 17:26

Re: [WD20] How to tell if a Dashboard widget is shown or hidden

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


von Curtis - am 28.05.2015 19:24

Re: [WD20] How to tell if a Dashboard widget is shown or hidden

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.

von Curtis - am 28.05.2015 20:34
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

von DW - am 29.05.2015 02:13
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.