pcawdron
01-18-2007, 03:21 AM
What's the difference between a method and a handler? Why would you use one over the other in any given situation? They appear to be almost identical, which has me scratching my head wondering why there are two different scripting event types.
I came across an old, old, old (not so specky) OpenLaszlo example at...
http://www.xml.com/lpt/a/1677
And it had methods and handlers used interchangeably, so I thought I'd ask the question, why? Take a look at the code from the article and you'll see what I mean...
<text x="10" text="Add a New Contact" fontstyle="bold" bgcolor="#F2F2F2">
<handler name="onclick">
messagetext.setText("");
if(phonelist.visible){phonelist.setVisible(false); }
if(contactallinfo.visible){contactallinfo.setVisib le(false);}
newperson.setVisible(true);
newperson.resetForm();
newperson.title.setAttribute('text','New Contact');
</handler>
</text>
<text x="10" text="List all contacts in the book" fontstyle="bold" bgcolor="#F2F2F2">
<method event="onclick">
messagetext.setText("");
if(newperson.visible){newperson.setVisible(false); }
parent.parent.listAllContacts();
contactallinfo.setVisible(false);
phonelist.setVisible(true);
</method>
</text>
Just curious as to which one I should use in any given situation and why...
I came across an old, old, old (not so specky) OpenLaszlo example at...
http://www.xml.com/lpt/a/1677
And it had methods and handlers used interchangeably, so I thought I'd ask the question, why? Take a look at the code from the article and you'll see what I mean...
<text x="10" text="Add a New Contact" fontstyle="bold" bgcolor="#F2F2F2">
<handler name="onclick">
messagetext.setText("");
if(phonelist.visible){phonelist.setVisible(false); }
if(contactallinfo.visible){contactallinfo.setVisib le(false);}
newperson.setVisible(true);
newperson.resetForm();
newperson.title.setAttribute('text','New Contact');
</handler>
</text>
<text x="10" text="List all contacts in the book" fontstyle="bold" bgcolor="#F2F2F2">
<method event="onclick">
messagetext.setText("");
if(newperson.visible){newperson.setVisible(false); }
parent.parent.listAllContacts();
contactallinfo.setVisible(false);
phonelist.setVisible(true);
</method>
</text>
Just curious as to which one I should use in any given situation and why...