With a bit of spare time on my hands, I decided to dive deeper into Script Widgets.
My initial idea was to craft a simple yet practical Script Widget, and I settled on creating a Button Control.
However, navigating the creation process proved challenging, as there's scarce documentation available
online for Script Widgets .
Nevertheless, after much trial and error, I managed to piece together a functional button by borrowing
code snippets from an existing Script Widget I stumbled upon.
To my surprise, when I attempted to add a "mouseUp handler script" to the Script Widget in the stack, it failed to trigger
I theorized that these messages might be intercepted by the Script Widget itself, necessitating the inclusion of handlers
within the Script Widget to pass along mouseUp, mouseDown,etc. and similar events to be utilized in a Widget Script.
Unfortunately, this attempt also proved unsuccessful, leaving me puzzled as to why
I had hoped to employ Script Widgets in the same intuitive manner as other Controls from the "Tools Stack" – simply dragging
them onto the stack and setting an executable script.
However, it appears this isn't the case. Could someone kindly shed light on how I might achieve this?
Attached: My widget button script widget (button_0.3.livecodescript)
This is the script inside the button:
Code: Select all
on mouseUp
put "mouseUp"
pass mouseUp
end mouseUp
on mouseDown
put "mouseDown"
pass mouseDown
end mouseDown
on mouseEnter
put "mouseEnter"
pass mouseEnter
end mouseEnter
on mouseLeave
put "mouseLeave"
pass mouseLeave
end mouseLeave
on mouseMove
put "mouseMove"
pass mouseMove
end mouseMove
on mouseDoubleUp
answer "You did a mouseDoubleUp !"
pass mouseDoubleUp
end mouseDoubleUp
You can install the Script Widget and do a double click on the button in the Widget. It will answer "You did a mouseDoubleUp!" This proves that the script is actually present in the button. However, all the other messages which are sent - don't travel up the hierarchy
Why is this and how can I achieve my goal ?