Storing Images for use by Custom Controls

Simon Knight smk at anvic.net
Wed Jul 25 16:18:57 EDT 2018


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 lists.runrev.com> 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
> 
> Elementary Software
> (Now with 20% less chalk dust!)
> web       http://elementarysoftware.com/
> email     scott at elementarysoftware.com
> booth     1-800-615-0867
> 
>> On Jul 24, 2018, at 8:44 AM, Simon Knight via use-livecode <use-livecode at lists.runrev.com> 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.
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list