link 2 images via Ids?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

link 2 images via Ids?

Post by Tomka » Sun Jun 19, 2011 5:17 pm

Hi there,

In LC its possible to link a button with an image imported as control:

Code: Select all

 set icon of btn "b1" to 1117  //1117=id of the image
What I´m looking for is a way to link 2 images on a similiar way. That means that the source of a imagefield shouldnt be a file but a second image (refered by ID or name).

Is there a way to do so? Only found "filename"-property in the dictionary :(

best
Thomas
Last edited by Tomka on Sun Jun 19, 2011 5:32 pm, edited 1 time in total.

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

Re: link 2 images via Ids?

Post by Klaus » Sun Jun 19, 2011 5:20 pm

Hi Tomka,
That means that the source of a imagefield shouldnt be a file but a second image refered by ID or name.
sorry, don't understand a word!?

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: link 2 images via Ids?

Post by Tomka » Sun Jun 19, 2011 5:29 pm

@Klaus:

Ich schreib mal deutsch, weil ich das in Englisch nicht hinkriege.

Einem Image kann ich ja ein neues File zuordnen, dann ändert sich das Bild. Aber kann ich auch einem Bild "i1" als Quelle ein anderes Bild "i2" anstatt eines Files zuordnen?

Bei Buttons geht sowas ähnliches, wie ich es es meine, bei den Iconen:

set icon of btn "b1" to <id>


Besser erklärt? :)

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

Re: link 2 images via Ids?

Post by Klaus » Sun Jun 19, 2011 6:32 pm

Hi Tom,

AHA! I think I got it! :D

OK, so you don't want to change the filenname but put an image into another one.

Well, check this:
...
## Just in case:
set the lockloc of img "i1" to false
put img "i5" into img "i1"
## where image "i5" is of course an imported image and not a referenced image!

## this also works, but is much less intuitive...
set the text of img "i1" to the text of img "i5"
## THE TEXT OF AN IMAGE, HA! :D
...
Isn't it amazing? 8)


Best

Klaus

Post Reply