Dictionary error regarding TemplateObject
Posted: Mon Sep 22, 2014 3:05 am
The dictionary states, in the section on the "create" command:
Successive clicks on button 1 will create multiple copies of btn 2, all named "xx" and all overlying btn 2. Am I misreading the intent of the caveat to lock messages or the template button will be reset to defaults? It would seem this is a terrible waste of a fabulous feature. Once a template is set, it ought to persist throughout the current session, at the least. The good news is that it does not matter if I lock messages or not, so I am really asking if this paragraph is just bogus. Nothing of this sort is mentioned in the dictionary entries about the templates themselves, only in the "create" command entry.
Craig Newman
This is not so. Create two buttons. In the first, place this into its script:Note: In the development environment, after an object is created, LiveCode automatically resets the corresponding template to its default values. This means that if you change an objecttemplate and then create several objects of that type, only the first object will reflect your settings. To prevent LiveCode from automatically setting the template back to its defaults, set the lockMessages property to true before creating the objects:
Code: Select all
on mouseUp
set the properties of the templateButton to the properties of btn 2
create btn "xx"
end mouseUp
Craig Newman