Problem with Image on background property

Ken Ray kray at sonsothunder.com
Sun Feb 29 10:20:23 EST 2004


Steve,

Klaus is right... but I wanted to give a bit more detail. There are some
objects that have properties that can be shared (or not shared) among
multiple cards of a background and some that can't. Text in fields can
be made card-specific by turning off the sharedText property. Checkbox
and radio buttons can be made card-specific by turning off their
sharedHilite property. But other objects, such as images, menu buttons,
and graphics, are automatically shared across all cards of the
background, and there is no in-built property (AFAIK) to change this
behavior.

So for those kinds of objects, a good approach is to store the path to
the image (or selection in a menu button, etc.) in a custom property on
each card, and then on preOpenCard reinstate that path/selection from
the custom property before the card draws. I usually store the value
immediately after I get it, and give it a name that is very similar to
the object's name itself like:

-- For menu button "Color"

on menuPick pChoice
  set the uColorMenu of this card to pChoice
  --etc.
end menuPick

-- For images, like a person's picture in an address book
-- This is the script that sets the image, perhaps
-- clicking on the image object itself

on mouseUp
  answer file "Select an image for this person:"
  if it is not empty then
    set the fileName of me to it
    set the uPersonImage of this card to it
    -- etc.
  end if
end mouseUp

HTH,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of 
> Stephen King
> Sent: Sunday, February 29, 2004 7:51 AM
> To: use-revolution at lists.runrev.com
> Subject: Problem with Image on background property
> 
> 
> Hi all,
> 
> I'm sure this is really simple, but I can't understand what 
> is happening.
> 
> I am experimenting with a basic database example and have an 
> image on the card as part of the background group. I start 
> with a card with empty fields and image (no file reference). 
> I then fill in data, reference an image file and create a new 
> card. When I create new card, all the fields and labels are 
> generated as expected, and all the fields are empty as 
> expected, but the image is not empty. Worse, if I drag a new 
> image in on this new card, all other cards reflect the same image.
> 
> If its relevant, after dragging the image in, I save a 
> thumbnail of the image then use this as the file reference. 
> There is a need for thumbnail pictures elsewhere in the system.
> 
> Any ideas why each card sees the same image and why the image 
> reference appears on new generated cards?
> 
> I have looked at the database example in the tutorials, but 
> it doesn't seem to use create card (not that I can find anyway).
> 
> Cheers
> Steve
> 
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 




More information about the use-livecode mailing list