Passing parameter(s) to Popup menu?

The easiest way to do this is with a custom property on each label:

  1. Create a label, giving it a string custom property of ‘tagName’. Write the full path of the SQLTag to be reset to this property.

  2. In both the mousePressed and mouseReleased events of the label (required so it will run cross-platform), put the following code:menu = app.util.getPopup() menu.show(event)

  3. Create a new module called ‘util’ in the Script Module Editor and put the following code in it:[code]def getPopup():
    import system

    The function which is carrying out the resetting

    def reset(event):
    import system

    tagName = event.source.tagName
    system.tag.write(tagName, 0)

    Create the actual popup menu and return it

    popup = system.gui.createPopupMenu([“Reset”],[reset])
    return popup[/code]Now when you right-click on the label you will get a popup containing a ‘Reset’ entry - clicking this will set the point back to zero.

If you want to reset to any other value you can change the value in the reset function. If you want to reset different points to different values, you will have to create another custom property for each label and use this within the reset function.