Page 159 - DCAP512_WAP_AND_WML
P. 159

Unit 11: Using WML Script




          More about Functions                                                                  Notes
              Can be predefined by the system
              Can be created by the developer
              Are typically grouped into libraries

              Accept input parameters, then return values based on the input
          Compilation Units
              This is an example of a single wmls file

              Scope is defined by the presence of extern
          extern function f1() {
                 …
          }
          extern function f2() {

                 …
          }
          extern function f3() {
                 …

          }


                 Example: Another example is given below.
          extern function openDialog() {
          var doContinue =Dialogs.confirm(“Continue?”, “Yes “, “No”);
                 // yes is ok
                 // no is cancel

                 if (doContinue) {
                         WMLBrowser.setVar (“test”, “we continued”);
                 }
                 else {

                         WMLBrowser.setVar (“test”, “we stop continue”);
                 }
                 WMLBrowser.refresh();
          }

          Return Values
          These accomplish the same thing.
                 extern function MyFunct() {







                                           LOVELY PROFESSIONAL UNIVERSITY                                   153
   154   155   156   157   158   159   160   161   162   163   164