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

Reply via email to