I think you are misunderstanding delegate:  
http://labs.openlaszlo.org/trunk-nightly/docs/reference/LzDelegate.html

If test2 is a method on the canvas and you want to invoke it when button is clicked, you would say:

  new LzDelegate(canvas, 'test2', delete_button, "onclick")


On 2008-07-21, at 16:49EDT, Kenneth Miller wrote:

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.

http://github.com/xkenneth/buildoutbuilder/tree/master/buildoutbuilder.laszlo/src

buildoutbuilder.lzx is the file you're looking for.

Thanks again!

Regards,
Ken

On Jul 21, 2008, at 3:18 PM, Henry Minsky wrote:

Do you have a "test2" method defined on button? It would seem to me
that you don't, because you're instantiating
it right there, and there is no test2 method defined in the lz button
component class, that I know of..


On Mon, Jul 21, 2008 at 4:06 PM, Kenneth Miller <[EMAIL PROTECTED]> wrote:
All,
Here's the error: ERROR @lz/button.lzx#35: Invalid delegate: button
text=Delete.test2 => «undefined» (must be a Function)
Regards,
Ken
On Jul 21, 2008, at 2:00 PM, Henry Minsky wrote:

You can call a method on another object, using a delegate, but you'd
have to create the delegate to point to your object

e.g.,

new LzDelegate(yourinstance, "test2")

Your delegate was created to call the test2 method on your button instance.
...



On Mon, Jul 21, 2008 at 2:59 PM, Henry Minsky <[EMAIL PROTECTED] >
wrote:

What is the error? Your test2 method is never getting called? Where is

the "test2" method being declared on

the button class?  Don't you need a subclass of button, in order to

define your method on it?


On Mon, Jul 21, 2008 at 2:40 PM, Kenneth Miller <[EMAIL PROTECTED]> wrote:

I'm trying to create a new button here and attach an event to it, can anyone

tell me what I'm doing wrong?

function create_part() {

//get the part name

part_name =

canvas .main_tabs .buildout_editor .buildout_toolbar.toolbar_slider.parts_tab.new_part_field.text

//add the part to the dom

buildout_dp.addNode(part_name)

//add it to the tab slider

canvas.main_tabs.buildout_editor.buildout_ts.addItem(part_name)

//wipe out the text field

canvas .main_tabs .buildout_editor .buildout_toolbar.toolbar_slider.parts_tab.new_part_field.text

= ''"

//create the delete button

var delete_button = new

lz .button (canvas.main_tabs.buildout_editor.buildout_ts.getItem(part_name))

delete_button.setAttribute('text','Delete')

//create the delegate

if ( typeof delete_button.del == "undefined" ) {

delete_button.del = new LzDelegate( delete_button, "test2");

}

//assign the event

delete_button.del.register( delete_button, "onclick" );

}

Regards,

Ken





--

Henry Minsky

Software Architect

[EMAIL PROTECTED]




--
Henry Minsky
Software Architect
[EMAIL PROTECTED]





--
Henry Minsky
Software Architect
[EMAIL PROTECTED]



Reply via email to