pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luiz Gustavo <luizgustav...@gmail.com>
Subject Default scripting Listeners
Date Wed, 08 Dec 2010 09:34:00 GMT
Is there a way to define a listener, as an element in bxml file, for use in
more than one component, as a dereference attribute value? For example:

We can define listeners for each component like this:

<Window xmlns="org.apache.pivot.wtk"
    xmlns:bxml="http://pivot.apache.org/bxml">
    <PushButton buttonData="Click Me!">
        *<buttonPressListeners>
        function buttonPressed(button) {
            // Handle event
        }
        </buttonPressListeners>*
    </PushButton>

    <PushButton buttonData="Click Me Again!">
        *<buttonPressListeners>
        function buttonPressed(button) {
            // Handle event
        }
        </buttonPressListeners>*
    </PushButton>
</Window>


But if the listener action is the same fo the two buttons above, could I
define something like the following?


<Window xmlns="org.apache.pivot.wtk"
    xmlns:bxml="http://pivot.apache.org/bxml">

   * <ButtonListener bxml:id="listener">
        function buttonPressed(button) {
            // Handle event
        }
    </ButtonListener>*

    <PushButton buttonData="Click Me!" *buttonPressListeners="$listener"*/>

    <PushButton buttonData="Click Me Again!" *
buttonPressListeners="$listener"*/>

</Window>



Cheers,
Luiz Gustavo S. de Souza

http://luizgustavoss.wordpress.com
http://luizgustavoss.blogspot.com
http://twitter.com/lugustso

Mime
View raw message