I have a general question in regards to message handlers in ignition.
I want to open a popup with a messagehandler, through either a gateway event script or a tag change script.
I know that i define the popup id through system.perspective.openPopup like so:
system.perspective.openPopup(
id="dataReceivedPopup",
view="Views/DataRecieved",
params={},
modal=True,
showCloseIcon=True
)
logger.info("Popup 'dataRecievedPopup' opened successfully.")
so if i want to call this message handler, how do i refer to its id directly?
i know there's a parameter called messageType but it doesn't seem to be what i need.
Note that this is not a message handler via a Component, but rather a message that should be invoked after a Boolean Tag is set to True, as a result of a doPost method in WebDev.
For invoking the message handler, I looked into using a Tag Change(value changed) script (for the boolean tag) :
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
logger = system.util.getLogger("DataArrivalTagChange")
logger.info("DataArrival tag changed to: {}".format(currentValue))
if currentValue.value and not initialChange:
system.perspective.sendMessage(
messageType="openDataReceivedPopup",
payload={}, # pass necessary data here if needed
scope="session"
)
but it seems to only be for gateway scope and not the perspective session, which is what i need.
i could perhaps create a property change script and bind the property to the boolean tag?
Any good ideas on how to solve this?
The dataflow would be something like:
Data -> doPost -> Save data to tag and set DataArrival tag to True ->
Invoke message handler to open popup -> "data recieved view"