Storing Images for use by Custom Controls

BNig bernd.niggemann at uni-wh.de
Wed Jul 25 17:22:55 EDT 2018


Simon,

try to add "of me" like below

 repeat with x=1 to the number of images of me 
      put the ID of image x of me into tID 
      put the short name of image x of me into tName 
      put tID into ImageA[tName] 
   end repeat 

Kind regards

Bernd


scott--- via use-livecode wrote
> Well I tried using custom props but did not get very far with them.  My
> solution is to add the image files to the group and hide them behind other
> controls.  I have added the attached handler that sets the button icons to
> the values of the images in the group.  The handler should be called when
> the original control is duplicated but.  
> 
> I used the array to ensure that the handler only finds images that are
> part of the group:
> 
> on newgroup
>    -- set the icons for the buttons
>   
>    --build an array of refs to images in the group
>    repeat with x=1 to the number of images of me
>       put the ID of image x into tID
>       put the short name of image x into tName
>       put tID into ImageA[tName]
>    end repeat
>    
>    --now set the icons
>    set the icon of button "add" of me to ImageA["imgPlus"]
>    set the icon of button "SortA" of me to ImageA["imgSort"]
>    set the icon of button "Delete" of me to ImageA["imgBin"]
>    
>    set the icon of button "SortB" of me to ImageA["imgSort"]
>    set the icon of button "Remove" of me to ImageA["imgLeftArrow"]
>    set the icon of button "Use" of me to ImageA["imgLeftArrow"]   
> end newgroup
>> On 24 Jul 2018, at 23:36, scott--- via use-livecode <

> use-livecode at .runrev

> > wrote:
>> 
>> Hello Simon,
>> I see I probably misunderstood what you were trying to do. With a custom
>> control I might be tempted to store the images in a customProp if I
>> wanted multiple resolutions to travel with the group object. Then do
>> something like setting the imageData of the image.
>>>> Scott
> 
>>> On Jul 24, 2018, at 8:44 AM, Simon Knight via use-livecode <

> use-livecode at .runrev

> > wrote:
>>> 
>>> Is there an elegant method of storing images for use by a custom
>>> control?  I have tried adding the images to the custom control group but
>>> the buttons in copies of the first group refer back to the first group
>>> so there is no advantage when compared to storing the images on a card
>>> or in a folder.
>>> 
>>> best wishes
>>> 
>>> Simon K.





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




More information about the use-livecode mailing list