MessageSubscriptionToken
ΒΆ
Message subscription token for nodes.
-- You can store a message handler token in a global variable and use it to acknowledge that the message handler is already installed.
if selectionChangedToken == nil then
local handler = function(arguments)
local source = arguments:getSource()
local name = source:getProperty(Node.NameProperty)
arguments:setHandled(true)
print("Message from " .. name)
end
local textBox = contextNode:lookupNode("TextBox")
selectionChangedToken = textBox:addMessageHandler(TextBoxConceptMetadata.SelectionChangedMessage, handler)
end
-- You can use the previously stored token to remove a message subscription.
if selectionChangedToken ~= nil then
local textBox = contextNode:lookupNode("TextBox")
textBox:removeMessageHandler(selectionChangedToken)
selectionChangedToken = nil
end