Hmmm just tested. Doesn't seem to work. I'll have to investigate why. The old 
script works though I pasted it numerous times. 

Bob S


> On Jul 24, 2018, at 09:35 , Bob Sneidar via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> No sooner said than done. Keep in mind this method depends on four things: 
> 
> 1. Your main group consists of a number of child groups composed of three 
> controls: a button, an icon image and a disabledIcon image
> 2. Your button names begin with "btn" and your images begin with "img" eg. 
> "btnNew"
> 3. Your "icon" images are named like your buttons, excluding the first three 
> characters eg. "imgNew"
> 4. Your "disabledIcon" images are named like your buttons, excluding the 
> first three characters, and ending in "Disabled" eg. "imgNewDisabled"
> 
> on newBackground
>   put the childcontrolNames of me into tGroupList
> 
>   repeat for each line tGroup in tGroupList
>      put the childControlNames of group tGroup into tControlList
>      filter tControlList with "btn*"
> 
>      repeat for each line tButtonName in tControlList
>         put char 4 to -1 of tButtonName into tControlName
>         put "img" & tControlName into tEnabledImage
>         put "img" & tControlName into tDisabledImage
>         set the icon of button tButtonName to the short id of image 
> tEnabledImage
>         set the disabledIcon of button tButtonName to the short id of image 
> tDisabledImage
>      end repeat
>   end repeat
>   pass newBackground
> end newBackground
> 
> 
>> On Jul 24, 2018, at 09:14 , Bob Sneidar via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> I have a custom control group with a series of buttons, each with an enabled 
>> icon and a disabled icon. I have this if the group script, which should give 
>> you some idea how to proceed:
>> 
>> on newBackground
>>  -- Relink buttons to graphics as they all have different ID's now
>>  set the icon of button "btnNew" to the short id of image "imgNew"
>>  set the disabledIcon of button "btnNew" to the short id of image 
>> "imgNewDisabled"
>>  set the icon of button "btnDelete" to the short id of image "imgDelete"
>>  set the disabledIcon of button "btnDelete" to the short id of image 
>> "imgDeleteDisabled"
>>  set the icon of button "btnEdit" to the short id of image "imgEdit"
>>  set the disabledIcon of button "btnEdit" to the short id of image 
>> "imgEditDisabled"
>>  set the icon of button "btnCancel" to the short id of image "imgCancel"
>>  set the disabledIcon of button "btnCancel" to the short id of image 
>> "imgCancelDisabled"
>>  set the icon of button "btnSave" to the short id of image "imgSave"
>>  set the disabledIcon of button "btnSave" to the short id of image 
>> "imgSaveDisabled"
>>  set the icon of button "btnHome" to the short id of image "imgHome"
>>  set the disabledIcon of button "btnHome" to the short id of image 
>> "imgHomeDisabled"
>>  pass newBackground
>> end newBackground
>> 
>> In retrospect I should have created a loop, but that would depend on the 
>> image names being predictable. As you can see I have named all my icons in 
>> such a way so as to reflect the name of the button itself. If you do that, 
>> this could be made into a generic handler that would work for any group with 
>> buttons next to their icon images, and you wouldn't need to use literals. 
>> 
>> Bob S
>> 
>> 
>>> On Jul 24, 2018, at 08:44 , Simon Knight via use-livecode 
>>> <use-livecode@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to