Listener on text.reel?

10 views
Skip to first unread message

Wolfram Kriesing

unread,
Jul 18, 2014, 8:40:38 AM7/18/14
to mont...@googlegroups.com
Hi, 

I was trying to add a listener to a text.reel so i can handle clicks or whatever on a text field ...
what am I missing here? I tried "click" and "action" but I dont get neither one to work :(
thanks for help in advance

Wolfram

António Afonso

unread,
Jul 18, 2014, 12:23:29 PM7/18/14
to mont...@googlegroups.com
Hi Wolfram,

The Text component does not fire any event related to clicks (like the Button does with the `action` event), it's only meant to display text after all.
If you want a component to react to clicks you can use the PressComposer. The composers architecture exist to enrich components with additional, orthogonal, behavior.


The PressComposer fires the following events: `pressStart`, `press`, `pressEnd`.
Other available composers are: TranslateComposer, KeyComposer and SwipeComposer: https://github.com/montagejs/montage/tree/master/composer

I hope this helps!

Wolfram Kriesing

unread,
Jul 18, 2014, 3:42:06 PM7/18/14
to mont...@googlegroups.com
Hi Antonio,

thanks a lot for the answer. 

In the docs is stated "In Montage, the target object can be any JavaScript object, not just a DOM element." http://docs.montagestudio.com/montagejs/event-handling.html that's why I was hoping that I was just too stupid :) Is it that a ui/component in this case text is just not wired up this way by default, right?

Wolfram

afo...@montagestudio.com

unread,
Jul 19, 2014, 10:44:25 AM7/19/14
to mont...@googlegroups.com

Actually there was a change in which objects can be a target, but for the case of components this information still holds.
Only objects extending `Target` have the {add,remove}EventListener/dispatchEvent interface implemented and this is the case of the Component.

However, Component does not fire any event by default. Components like the `Button` or the `Checkbox` fire the `action` event. This is explicitly implemented in those components: https://github.com/montagejs/montage/blob/master/ui/base/abstract-button.js#L214-L224
Reply all
Reply to author
Forward
0 new messages