ActionListener and Anchor.reel

23 views
Skip to first unread message

jlmi...@kahalawai.com

unread,
Feb 17, 2014, 8:38:52 PM2/17/14
to mont...@googlegroups.com
Hi,

How does one set an action listener binding on an anchor.reel component?  I can't seem to find an example...

Thank you,

Johnny

Mike Czepiel

unread,
Feb 17, 2014, 9:59:46 PM2/17/14
to jlmi...@kahalawai.com, mont...@googlegroups.com
Mfiddle happens to be using our digit component set so I can illustrate the approaches you have available;
substitute as necessary with any other component that emits an event instead of the button used herein.

Here's an example of event handling semantics in action:

The convention used is outlined here: http://montagejs.org/docs/event-handling.html
(Though we could really use a simpler diagram now that I look there.)

Here's us using an actionEventListener to call a target method in response to an event:

And here's an exploration on some of the runtime flexibility the AEL affords:

Hope that helps,
mike



--
You received this message because you are subscribed to the Google Groups "Montage JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to montagejs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/montagejs.
For more options, visit https://groups.google.com/groups/opt_out.

jlmi...@kahalawai.com

unread,
Feb 18, 2014, 1:53:19 AM2/18/14
to mont...@googlegroups.com, jlmi...@kahalawai.com
Looks like we went off the forum...

Ah ha.  No problem... thanks for showing me that.

This ended up working...

/**
 * @module ui/action-link.reel
 * @requires montage/ui/base/abstract-link.reel
 */
var AbstractLink = require("montage/ui/base/abstract-link").AbstractLink;
/**
 * @class ActionLink
 * @extends Component
 */
var ActionLink = exports.ActionLink = AbstractLink.specialize( /** @lends ActionLink# */ {

    constructor: {
        value: function ActionLink() {
            this.super();
        }
    }

});


But the label property doesn't seem to do anything?  I tried label, textAlternative and textContent.  Is that by design?  Should I put dynamic text inside a link inside another component like a text reel?

Best

Mike Czepiel

unread,
Feb 18, 2014, 2:51:57 PM2/18/14
to jlmi...@kahalawai.com, montagejs
Yeah, I guess that's not surprising that the label doesn't appear; the abstractControls typically rely on a concrete implementation to do the rendering.

Off the top of my head something like this should work:
```
draw: {
    value: function () {
        this.element.textContent = this.label;
    }
}
```

I'll mention maybe adding a basic concrete implementation to Montage. As you can tell, it's not a component we use a lot ourselves; we get a lot of mileage out of button to drive most of our interfaces.


Reply all
Reply to author
Forward
0 new messages