Nic
06-22-2004, 06:40 AM
Hi,
As a newbie to Laszlo, I am struggling to understand the best way to build a custom control.
I see two ways:
1. Create a new class by extending a control
2. Create a new class and embed other elements.
I have gone for the second one as it appears to be the easiest way to control the look and feel.
I have created a new class that embeds an imputtext box. I have done this to allow me to create border around the control. Result is an input text box with a border. However I also want to be able to capture events from the input text box in the new class. i.e. make the input box with the border behave like a normal input text.
For instance if I have an onblur fire on the input text, how do I call the custom code in my instantiation of the custom class.
I have declared an instance of my custom class as:
<mytextfield name="fName" label="First Name">
<method name="error">
debug.write("blurring custom error...");
</method>
</mytextfield>
I want error to be called when the onblur event fires on the inputtext box. I need this to allow me to define a different piece of code for each instantiation of the mytextfield.
Any pointers on how exactly to do this is much appreciated.
Thanks in advance
Nic
As a newbie to Laszlo, I am struggling to understand the best way to build a custom control.
I see two ways:
1. Create a new class by extending a control
2. Create a new class and embed other elements.
I have gone for the second one as it appears to be the easiest way to control the look and feel.
I have created a new class that embeds an imputtext box. I have done this to allow me to create border around the control. Result is an input text box with a border. However I also want to be able to capture events from the input text box in the new class. i.e. make the input box with the border behave like a normal input text.
For instance if I have an onblur fire on the input text, how do I call the custom code in my instantiation of the custom class.
I have declared an instance of my custom class as:
<mytextfield name="fName" label="First Name">
<method name="error">
debug.write("blurring custom error...");
</method>
</mytextfield>
I want error to be called when the onblur event fires on the inputtext box. I need this to allow me to define a different piece of code for each instantiation of the mytextfield.
Any pointers on how exactly to do this is much appreciated.
Thanks in advance
Nic