[Laszlo-user] method problem

Steven Melzer smmelzer at gmail.com
Fri Apr 6 21:35:47 PDT 2007


I am a newbie to OL (using it for the first day now) and I have a  
curious issue.

I am trying to make a "sign in" modal dialog box.  I want this to be  
a class so that I can re-use it.  I have the following code in a canvas:
   <class name="signinModalDialog" extends="modaldialog">
     <method name="sendSigninData">
      Debug.write("foo");
       var p = new LzParam();
       p.addValue("userName", userName.getText(), true);
       p.addValue("password", password.getText(), true);
       p.addValue("challenge", challenge.getText(), true);
       signinDS.setQueryString(p);
       signinDS.doRequest();
       this.close();
     </method>
     <form>
       <view>
       <text x="10" y="10">User ID</text>
       <edittext id="userName" x="100" y="10" />
       <text x="10" y="40">Password</text>
       <edittext id="password" x="100" y="40" />
       <text x="10" y="70" width="100" height="200"  
multiline="true">What is your pet's name</text>
       <edittext id="challenge" x="100" y="70" />
             <button x="200" y="110" onclick="md.sendSigninData 
()">OK</button>
       </view>
     </form>
   </class>

   <button onclick="md.open();">Show Modal Dialog</button>
   <signinModalDialog id="md" width="300" height="200" title="Sign  
In" />

Notice that the button (the highlighted line) makes a reference to  
the id of the instance of the class, from within the class.  This  
works, but obviously isn't very reusable since any implementation of  
the class has to be named "md".  I am not exactly sure why this works  
even, seems non-OO.  But anything else I try causes a "method not  
found" error in the debugger.  I have tried no reference, the class  
name reference, parent, super, canvas, and have no luck.  What is the  
correct way to reference the method in the class from the button also  
in the class.

Thanks,
Steven Melzer
smmelzer at gmail.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20070406/45bf40d6/attachment-0001.html


More information about the Laszlo-user mailing list