<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Why does it have to be defined "on" the button, it's defined in the source, which you can view here. Thanks for your time.<div><br></div><div><a href="http://github.com/xkenneth/buildoutbuilder/tree/master/buildoutbuilder.laszlo/src">http://github.com/xkenneth/buildoutbuilder/tree/master/buildoutbuilder.laszlo/src</a></div><div><br></div><div>buildoutbuilder.lzx is the file you're looking for.</div><div><br></div><div>Thanks again!</div><div><br></div><div>Regards,</div><div>Ken</div><div><br></div><div><div><div><div>On Jul 21, 2008, at 3:18 PM, Henry Minsky wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Do you have a "test2" method defined on button? It would seem to me<br>that you don't, because you're instantiating<br>it right there, and there is no test2 method defined in the lz button<br>component class, that I know of..<br><br><br>On Mon, Jul 21, 2008 at 4:06 PM, Kenneth Miller &lt;<a href="mailto:xkenneth@gmail.com">xkenneth@gmail.com</a>> wrote:<br><blockquote type="cite">All,<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;Here's the error: ERROR @lz/button.lzx#35: Invalid delegate: button<br></blockquote><blockquote type="cite"> text=Delete.test2 => «undefined» (must be a Function)<br></blockquote><blockquote type="cite">Regards,<br></blockquote><blockquote type="cite">Ken<br></blockquote><blockquote type="cite">On Jul 21, 2008, at 2:00 PM, Henry Minsky wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">You can call a method on another object, &nbsp;using a delegate, but you'd<br></blockquote><blockquote type="cite">have to create the delegate to point to your object<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">e.g.,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">new LzDelegate(yourinstance, "test2")<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Your delegate was created to call the test2 method on your button instance.<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Mon, Jul 21, 2008 at 2:59 PM, Henry Minsky &lt;<a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a>><br></blockquote><blockquote type="cite">wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">What is the error? Your test2 method is never getting called? Where is<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">the "test2" method being declared on<br></blockquote><blockquote type="cite"><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"><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"><br></blockquote><blockquote type="cite">I'm trying to create a new button here and attach an event to it, can anyone<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">tell me what I'm doing wrong?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">function create_part() {<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;//get the part name<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;part_name =<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">canvas.main_tabs.buildout_editor.buildout_toolbar.toolbar_slider.parts_tab.new_part_field.text<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;//add the part to the dom<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;buildout_dp.addNode(part_name)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;//add it to the tab slider<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;canvas.main_tabs.buildout_editor.buildout_ts.addItem(part_name)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;//wipe out the text field<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">canvas.main_tabs.buildout_editor.buildout_toolbar.toolbar_slider.parts_tab.new_part_field.text<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">= ''"<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;//create the delete button<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;var delete_button = new<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">lz.button(canvas.main_tabs.buildout_editor.buildout_ts.getItem(part_name))<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;delete_button.setAttribute('text','Delete')<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;//create the delegate<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;if ( typeof delete_button.del == "undefined" ) {<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;delete_button.del = new LzDelegate( delete_button, "test2");<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;//assign the event<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;delete_button.del.register( delete_button, "onclick" );<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Regards,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Ken<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></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"><br></blockquote><blockquote type="cite">Software Architect<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br></blockquote><blockquote type="cite"><br></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><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></div></body></html>