<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">All,<div><br></div><div>&nbsp;&nbsp; &nbsp;Here's the error:&nbsp;ERROR @lz/button.lzx#35: Invalid delegate: button &nbsp;text=Delete.test2 => «undefined» (must be a Function)&nbsp;</div><div><br></div><div>Regards,</div><div>Ken</div><div><br><div><div>On Jul 21, 2008, at 2:00 PM, Henry Minsky wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>You can call a method on another object, &nbsp;using a delegate, but you'd<br>have to create the delegate to point to your object<br><br>e.g.,<br><br>new LzDelegate(yourinstance, "test2")<br><br>Your delegate was created to call the test2 method on your button instance. ...<br><br><br><br>On Mon, Jul 21, 2008 at 2:59 PM, Henry Minsky &lt;<a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a>> wrote:<br><blockquote type="cite">What is the error? Your test2 method is never getting called? Where is<br></blockquote><blockquote type="cite">the "test2" method being declared on<br></blockquote><blockquote type="cite">the button class? &nbsp;Don't you need a subclass of button, in order to<br></blockquote><blockquote type="cite">define your method on it?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Mon, Jul 21, 2008 at 2:40 PM, Kenneth Miller &lt;<a href="mailto:xkenneth@gmail.com">xkenneth@gmail.com</a>> wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">I'm trying to create a new button here and attach an event to it, can anyone<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">tell me what I'm doing wrong?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">function create_part() {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;//get the part name<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;part_name =<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">canvas.main_tabs.buildout_editor.buildout_toolbar.toolbar_slider.parts_tab.new_part_field.text<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;//add the part to the dom<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;buildout_dp.addNode(part_name)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;//add it to the tab slider<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;canvas.main_tabs.buildout_editor.buildout_ts.addItem(part_name)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;//wipe out the text field<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> canvas.main_tabs.buildout_editor.buildout_toolbar.toolbar_slider.parts_tab.new_part_field.text<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">= ''"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;//create the delete button<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;var delete_button = new<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">lz.button(canvas.main_tabs.buildout_editor.buildout_ts.getItem(part_name))<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;delete_button.setAttribute('text','Delete')<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;//create the delegate<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;if ( typeof delete_button.del == "undefined" ) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;delete_button.del = new LzDelegate( delete_button, "test2");<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;//assign the event<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;delete_button.del.register( delete_button, "onclick" );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Regards,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Ken<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--<br></blockquote><blockquote type="cite">Henry Minsky<br></blockquote><blockquote type="cite">Software Architect<br></blockquote><blockquote type="cite"><a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br></blockquote><blockquote type="cite"><br></blockquote><br><br><br>-- <br>Henry Minsky<br>Software Architect<br><a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br></div></blockquote></div><br></div></body></html>