Best Strategies for Duplicating Object
Brahmanathaswami
brahma at hindu.org
Mon Dec 1 18:59:58 EST 2014
Eric... thanks
that works.
clone button "Create Links"; set the name of it to "Siva"
I guess this is a documentation bug...under name it says:
"set the [long | abbr[ev[iated] | short] name of object to string"
implies that
clone button "Create Links"; set the short name of it to "Siva"
should work, but it doesn't
BR
Eric Corbett wrote:
> Try setting the name, not the short name.
>
> I often use templates and copy or clone them. I use template... to create groups usually.
>
> - eric
>
>
> On Dec 1, 2014, at 2:57 PM, Brahmanathaswami wrote:
>
>> 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 mouseup"
>> 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 "http://dev.himalayanacademy.com/looklisten/music"
>> 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?
>>
>> this:
>>
>> 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!
>> Brahmanathaswami
>>
>> Kauai's Hindu Monastery
>> www.HimalayanAcademy.com
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list