PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD19]How to Create Dynamic Widgets / Internal Windows?
[WD19]How to Create Dynamic Widgets / Internal Windows?
Iniciado por guest, 17,mar. 2015 15:55 - 4 respuestas
Publicado el 17,marzo 2015 - 15:55
I would like to be able to dynamically create and add widgets(internal windows) to my dashboard control. For example, say I have an unknown number of students. I would like a widget for each student that displays their grade in the class. How would I dynamically create 12 widgets for the 12 students in Class 1?

I'm trying to figure this out, but so far I'm coming up blank.
Publicado el 17,marzo 2015 - 17:12
Hi Curtis,

I have tried this myself but i think it is not possible now. Maybe in Windev 21?
AFAIK widgets can not be dynamically created.

Regards,

Joris.
Publicado el 17,marzo 2015 - 17:18
Internal windows are the only thing that can be used as widgets, correct?

The only thing I can think of is to have a large number of pre-made internal windows with default layouts/controls. For example, if the maximum number of students is 25 I would have to create 25 separate default internal windows. Then I can add and modify what I need.

Not sure what the overhead cost for that might be.
Publicado el 17,marzo 2015 - 18:07
Hi Curtis,

You only need one Internal Window to do that. You create an internal Window, call it "IW_Student" for example. Then you simply add 12 or 24 widgets based on the exact same internal window with DashAddWidget(). You simply pass in parameter the student ID or data and you are in business and keep the indices returned by the DashAddWidget() proc to make reference to the good widget.

Look at the dashboard control's help to know how to code that.

Best regards,
Alexandre Leclerc
Publicado el 17,marzo 2015 - 18:17
Did not know you can do that Alexandre. That should work well for my purposes. Thanks!