Message Handler not triggering on component click event

Ignition 8.1.6 (b2021052512)

Hi, I'm trying to implement component message handlers, refering to this tutorial
Component Message Handlers

Mouse click event on the button:

system.perspective.sendMessage('my_handler')

Message Handler on the text area:

self.props.text="this is a test"

A click on the button should display a specific text in my text_area.
But this never happens. I might have missed something simple...

Below is an export of my test project
iot_project_20210603164103.zip (8.5 KB)

1 Like

Hi @Marc.Akoto, main thing to check is the scope for the message. The send will default to page, is this the same for the handler? Also, I assume the handler matches the case, etc. exactly?

I will try and look at your project specifically later (but this will likely be an hour+ :sweat_smile:)

Using a logger is probably the easiest way to debug where the message is getting stuck.

Your scope is indeed the problem: Your text area is listening on the view scope, but since you have not supplied a scope to the sendMessage call it will default to the “page” scope, which is explicitly stated in the documentation and intellihint.
Screen Shot 2021-06-03 at 8.43.24 AM Screen Shot 2021-06-03 at 8.43.41 AM

Changing the scope in either location to match the scope in the other will get this working.

2 Likes

Got it, thanks @cmallonee @matthew.ayre

1 Like