Hello,
Can you provide a simple example for using a GUI Composer v3 button to set a value on the target?
I understand the step of adding an event listener for "clicked". What I'm missing is how to set data on the target.
GcWidget.querySelector('#button').then(widget => {
widget.addEventListener('clicked', () => alert("Button Clicked!"));
});
If I have a global variable in the sample application on the target called 'sampledata', I guess is that I need to work with widget.pm.sampledata. What I want to do is something like this:
GcWidget.querySelector('#button').then(widget => {
widget.addEventListener('clicked', () => widget.pm.sampledata = 1
});
...but of course the 'widget.pm.sampledata=1' is not the right syntax.
I have looked at the gallery for projects with search term "button". The projects there are either for v2 applications or do not use buttons with actual hardware.
Thanks!