Dashboard Component Question - Iterating Over Widgets

Hello,

I’m using a Dashboard for a project and have several questions relating to this component:

  1. Is it possible to create an event script that runs when a widget is deleted or created by a user when the dashboard is in edit mode?

  2. I’m trying to dynamically assign view parameters (such as machine number) to widgets depending on how many existing widgets with the same name. I want to use something akin to this:

machineNameCount = {}
for widget in activeWidgets:
    machineNameCount[widget.GetName()] = 0
for widget in active Widgets:
    machineNameCount[widget.GetName()] += 1
    widget.SetNumber(machineNameCount[widget.GetName()])

Is there a way such as this to iterate over available widgets and widgets and assign view parameters to the widget based on the number of instances (and other properties) of that availableWidget?

Thank you,
Nick

Nick, you missed the </> code formatting button which will preserve indents and apply syntax highlighting. Hit the pencil icon below your original post …