pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Scripts and Actions
Date Wed, 16 Sep 2009 20:40:19 GMT
Unfortunately, you can't declare event handlers that way.  
WTKXSerializer expects an actual named function for each event handler  
method you want to define.

I think the best way to reduce the amount of script code would be via  
the attribute-based event handlers we have discussed adding.


On Sep 16, 2009, at 3:31 PM, Vicente de Rivera III wrote:

> Hi, I have a followup question about action listeners in wtkx. Right  
> now I have,
>       "
>                  <PushButton buttonData="Logout">
>                                                      
> <buttonPressListeners>
>                                                         <wtkx:script>
>                                                          <![CDATA[
>
> function buttonPressed(button) {
>
> application.doSwitch(0);
>                                                                 }
>                                                          ]]>
>                                                         </wtkx:script>
>                                                     </ 
> buttonPressListeners>
>                                                 </PushButton>
>                                                 <PushButton  
> buttonData="Home">
>                                                      
> <buttonPressListeners>
>                                                         <wtkx:script>
>                                                          <![CDATA[
>
> function buttonPressed(button) {
>
> application.doSwitch(1);
>                                                                 }
>                                                          ]]>
>                                                         </wtkx:script>
>                                                     </ 
> buttonPressListeners>
>                                                 </PushButton>
>   "
> I'd like to reduce this to a single var, I tried defining
>   "
>                   <wtkx:script>
>                     var doNav = function(idx){
>                         return function buttonPressed(button) {
>                            application.doSwitch(idx);
>                         }
>                      };
>                  </wtkx:script>
>    "
> then call, $doNav() for both PushButton but it doesn't work.
> Any way to reduce my script?
>
> thanks!
> -
> thirdy


Mime
View raw message