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]

Reply via email to