laszfellow
01-24-2007, 06:33 AM
I can't seem to get edittext to catch onclick event.
I am able to get it to catch on keydown/up event.
I wish to have an edittext box, that initially says in grey font,
"Please enter your name here".
So that when user clicks on edittext box, cleartext() would clear away the text.
<class name="DataEntryWindow" extends="windowpanel">
<attribute name="ClickedAlreadyLa" type="boolean" value="false"/>
<edittext name="DataText" text="Enter your name here, dear.">
<handler name="onkeydown" args="key">
<![CDATA[
if(key==13 && getValue().length > 0)
canvas.httpSend("userName", getValue());
]]>
</handler>
<handler name="onclick">
Debug.write(this+"What should I do to make you catch me?");
if(!ClickedAlreadyLa)
{
setAttribute("ClickedAlreadyLa", true);
clearText();
}
</handler>
<method name="init">
super.init();
setMaxlength(width/fontsize);
</edittext>
</class>
onkeydown is caught but not onclick. The debug never gets written.
Question:
Does edittext get to catch onclick or is onclick never passed on to edittext?
Or, should I check if any parent has caught onclick but not passed it on?
Also, setMaxlength() does not work. Is it because I am using an older version of laszlo server? Would there be an older version of laszlo in which setMaxlength is not allowed in edittext?
I am able to get it to catch on keydown/up event.
I wish to have an edittext box, that initially says in grey font,
"Please enter your name here".
So that when user clicks on edittext box, cleartext() would clear away the text.
<class name="DataEntryWindow" extends="windowpanel">
<attribute name="ClickedAlreadyLa" type="boolean" value="false"/>
<edittext name="DataText" text="Enter your name here, dear.">
<handler name="onkeydown" args="key">
<![CDATA[
if(key==13 && getValue().length > 0)
canvas.httpSend("userName", getValue());
]]>
</handler>
<handler name="onclick">
Debug.write(this+"What should I do to make you catch me?");
if(!ClickedAlreadyLa)
{
setAttribute("ClickedAlreadyLa", true);
clearText();
}
</handler>
<method name="init">
super.init();
setMaxlength(width/fontsize);
</edittext>
</class>
onkeydown is caught but not onclick. The debug never gets written.
Question:
Does edittext get to catch onclick or is onclick never passed on to edittext?
Or, should I check if any parent has caught onclick but not passed it on?
Also, setMaxlength() does not work. Is it because I am using an older version of laszlo server? Would there be an older version of laszlo in which setMaxlength is not allowed in edittext?