Best Strategies for Duplicating Object

Brahmanathaswami brahma at
Mon Dec 1 17:57:31 EST 2014

I have a little widget I'm creating to help with internal discussion 
about web site development. To prepare, I could just drag book marks 
into folders in my browser but that's too weak...

So I have a button I can use to drop links onto and this triggers the 
creation of a new button

on dragEnter -- show a green outline around the drop target
    set the borderColor of the target to "green"
      set the dragaction to "copy"
end dragEnter

on dragDrop
    put the dragData["text"]  into tURL
    createButtonLink tURL
end dragDrop

on createButtonLink tURL
    ask "Name your button" with tURL
    put it into tButtonName
    create button tButtonName
    set the script of btn tButtonName to \
    "on mouseup" & cr & "revGoUrl " & quote & tURL & quote & cr &  "end 
end createButtonLink

I can then set the systemWindow to true and my little pallette rides on 
top of the screen and I can navigate web pages in Firefox...

This worked so nicely I want to make it a bit more robust and perhaps 
style the buttons. Put a "key point" into a custom property or in the 
script itself:

on mouseup
       put "Robust Sidebar" into fld "points"
revGoUrl ""
end mouseup

Now, my question is about best strategies. Of course with LC there's 
always ten different ways to do things. but if I want to tweak the look 
and feel of the buttons later, I think I need to include behaviors in 
the mix...

So rather than create a new button.. I could:

1) clone a button with the existing requirement, and then replace 
strings in the script and set name and the custom prop  for the newly 
cloned button.
2) perhaps use the "templateButton" but that seems a weak path.

What do others do?

And how to you change the name of a cloned object in the same script?


clone button "Create Links"; set the short name of it to "Hello"

Generates and error:

Script compile error:
Error description: seek: missing 'in'

but "it" contains a valid button reference... so what is wrong?

even this does not work:

set the short name of button ID 1037  to "hello"


Swasti Astu, Be Well!

Kauai's Hindu Monastery

More information about the Use-livecode mailing list