PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD21] Dashboard [SOLVED]
[WD21] Dashboard [SOLVED]
Débuté par Christine Wagner, 28 sep. 2017 08:33 - 4 réponses
Posté le 28 septembre 2017 - 08:33
I'm implementing a dashboard for our product. I need configurations for nearly each widget. And widgets may exist several times in the dashboard.

I have implemented a very simple dashboard, to try out all functionality. There is only one Internal Window named IW_Static, which only shows some text.

I can already add as many widget I like with different strings. (Using an edit field and a button. The button creates the widget with the given string)

I can already store the dashboard status and load it again (Using a global array to store the different strings and reading the string returned from DashSaveConfiguration; I'm creating each widget by programming on loading the saved status again.)

Now I need a functionality to update all instances of widgets shown on the dashboard (but only the ones visible, not the hidden ones.) There is a local procedure "Update" in the IW_Static. But how do I call this procedure? IW_Static.Update() calls only the Update method of the first instance. I can't find a way to get the instances from the dashboard.

Please, help! Any help is really appreciated! Thanks a lot for any idea! (You see, I'm really desperate already)

I will also need a functionality to update a specific instance, when it is changed from hidden to visible. Any idea there?

Best Regards
Christine Wagner
Posté le 28 septembre 2017 - 09:01
Sorry, I found a workaround.
I will call DashDisplay and update the widgets in the "Refreshing the IW_... Widget" section.
If someone knows a possibility to get the instance of a specific widget (of a certain subscript), I would nevertheless very much appreciate to find out about this.

Regards,
Christine Wagner
Posté le 03 octobre 2017 - 09:55
Hi

I did same kind of thing. To make graphs in dashboard. Use a template internal window withchart ( enable everything ) so control an be used for everything.
User can add charts to the dashboard by adding a chart widget and then adding s rows to a chart file

OK
Trick is to redraw the chart control. So you have to know what Id the dashboard item has

Add a widget in a file and save it with a dashboard ID

I have an internal window that loads a global dahboadrID and a periodnr. Then calculates stuff and draws graph

Hope you get a bit what I try to tell. If you need more info. Snet me a pb. Maybe I can sent you some code by mail ( Have to warn youthough code is in dutch ;-)

What do you want in your widgets? Charts like I did?


regards
Posté le 03 octobre 2017 - 11:46
I have of now (I'm currently checking in all my changes) a working solution for my dashboard. I'm not only showing charts, but my main widgets show statistical values. The widget, I implemented now to get everything to work, shows basically the number of datalines of a specific type (configured from the user).
My solution now is rather complicated. I have implemented a basic abstract Dashboard_Widget class and will implement a subClass for each type of widget. I'm storing these objects in a "garrWidgets is array of dynamic Dashboard_Widget" in the window with the dashboard. The code line creating the widget looks this way:
nDashSubscipt = DashAddWidget(DASH_Dashboard, garrWidgets[nArrSubscript].Widget, garrWidgets[nArrSubscript].Title, garrWidgets[nArrSubscript]) garrWidgets[nArrSubscript].Subscript = nDashSubscipt The Global declaration of my internal window looks like this:
PROCEDURE MyWindow(gclWidget is dynamic object Dashboard_Widget) This way I have access to the same object in both locations and can even change some value from within the internal window, without losing this info in the external one.
I'm now also able to store the exact state of the dashboard and load it again without having to know anything about the internal window itself.

I'm not sure this solution is the prettiest one possible, but it works. So I'm satisfied.

PS: I think I know what you mean and perhaps it would have simplified a lot of my code. Whenever adding a widget to the dashboard, you are adding it to the array (as am I, when I think about it). As the subscriptionId is strongly ascending, I know it looking at the size of the array. I do need some functions I can call for every Widget (getting the configurationstring for storing it for example). Using a class, I'm sure these methods exist. Using internal windows I wouldn't have this security for all widgets. But it would have been less code. Not sure which solution would be better, but I prefere my current one. Thanks a lot for your input!
Posté le 04 octobre 2017 - 21:13
Hi

Ok Works great doesn't it.

Ps
The thing with webdev though is the lack of support for internal windows in webdev. The dashboard in webdev cannot be properly resized due to the fact that internal windows can't

regards .