Storing Images for use by Custom Controls

BNig bernd.niggemann at uni-wh.de
Wed Jul 25 19:12:09 EDT 2018


I am sorry to say that my solution does not work if you paste the group on
the same card. 

However Simons solution works when "of me" is added in the repeat loop 

resolve image is not granular enough to distinguish between groups. Once you
paste the group onto a different card or stack then it works.


It could also be simplified to the following code since the images for icons
of the custom control are known

on newGroup
   set the hilitedIcon of button "bOne" of me to the short id of image
"redQMark" of me
   set the icon of button "bOne" of me to the short id of image "greenRound"
of me
end newGroup

Kind regards



bnig--- via use-livecode wrote
> Hi Simon,
> 
> I think the easiest way would be to copy the images your custom control
> uses
> to the custom controls. 
> then add this code to the group (it is for one button "bOne" and two
> images
> "greenRound" and "redQMark"
> 
> on newGroup
>    resolve image "redQMark" relative to button "bOne" of me
>    if it is not empty then 
>       set the hilitedIcon of button "bOne" of me to the short id of it
>    end if
>    resolve image "greenRound" relative to button "bOne" of me
>    if it is not empty then 
>       set the icon of button "bOne" of me to the short id of it
>    end if
> end newGroup
> 
> "NewGroup" is a message that the custom control gets when you paste it.
> That way the custom control is self contained and when you paste it into a
> new stack it will assign the ids of the images to your buttons.
> 
> Kind regards
> Bernd
> 
> That way they are contained in your custom control and the custom control
> can be self contained, i.e. can be reused in a different stack.





--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html




More information about the use-livecode mailing list