The templateField Keyword

Dave Cragg dcragg at lacscentre.co.uk
Mon Mar 13 03:29:47 EST 2006


On 13 Mar 2006, at 00:03, Gregory Lypny wrote:
>
> 	What you say below is not how I expect templateField to work based  
> on its description.  I thought that setting the templateField was a  
> one-time thing and that it remained in effect until it was reset.   
> Your handler based on the createField message would seem to make  
> templateField unnecessary because you're changing the style of  
> newly created fields using a script after they've been created,  
> whereas the point of templateField is to set those properties  
> before.  Am I misunderstanding what you've intended?


I think Dan's reply clears it up. There's no need to reset the  
templateField, although I learned it was a "good idea" back when I  
started with Metacard, and so have followed that advice like a good  
boy. ;-) I think the idea is that by immediately resetting the  
templatexxxxx, you don't leave any surprises around for the next time  
you create an object. But if you're solely in charge of what gets  
created, then I guess it doesn't matter.

The main point I wanted to make was that you should use "create  
field" in your own script to get a field that follows the template  
settings you have made. I don't think you can rely on the tool  
palette in the IDE to respect the settings you have made. I say this  
without knowing how the tool palette creates objects; I was just  
assuming it was likely to set the templateField itself before doing  
so. I also wasn't sure what the palette does after it has created an  
object, but Dan's reply suggests it sets back to the state it was in  
before.

Sorry for any confusion.

Dave




More information about the Use-livecode mailing list