Question about templateImage

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am

Question about templateImage

Post by keithglong » Wed Dec 17, 2014 7:58 pm

Hi All,

This might be a dumb question, but here goes... In the dictionary it states:
You can use the set command to set the properties of the templateImage before creating an image. The new image has the properties of the templateImage, by default. Changing the properties of the templateImage does not affect existing images.
Suppose you already have an empty image object in place. When you put a new image into the object, do the set properties of the templateImage apply to the image? Or do you have to create the object first for the properties to apply accordingly? From the dictionary, it seems that the image object must be created first.

Thanks,

- Boo
Gulf Breeze, FL

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Question about templateImage

Post by Klaus » Wed Dec 17, 2014 8:35 pm

Hi Boo,
keithglong wrote:Suppose you already have an empty image object in place. When you put a new image into the object, do the set properties of the templateImage apply to the image?
no. :D
keithglong wrote:Hi All,
This might be a dumb question, but here goes... In the dictionary it states:
Or do you have to create the object first for the properties to apply accordingly? From the dictionary, it seems that the image object must be created first.
Sorry, not quite sure what you are after?


Best

Klaus

keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am

Re: Question about templateImage

Post by keithglong » Wed Dec 17, 2014 8:44 pm

Hi Klaus,

I am currently experimenting. Anyway, what I meant is that it seems that after you set the properties of the templateImage, you must then create the image object programmatically directly afterwards, and then add your image to the image object for the properties to apply to the said image. Correct?

Thanks,

- Boo
Gulf Breeze, FL

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7394
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Question about templateImage

Post by jacque » Wed Dec 17, 2014 9:07 pm

The templateImage (and all other templates) only apply when creating a new object. Existing objects do not acquire properties suddenly (we'd be upset if that happened.)

The templateImage can include imagedata or a filename, which would mean the image content is already there when the new object is made. If you don't supply those, then the new image object will be empty but any other properties you've set on the template will be there.

The template objects are most useful when you need to script the creation of many similar objects. If you are only creating a single image, it isn't any harder to set the properties on the one you just made without messing around with templates.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am

Re: Question about templateImage

Post by keithglong » Wed Dec 17, 2014 9:15 pm

Thanks Jacqueline (and Klaus). Per my previous post, I am experimenting with images in an effort to optimize my efforts.

As always, I appreciate the input.

Cheers,

- Boo
Gulf Breeze, FL

Post Reply