Storing Images for use by Custom Controls
bernd.niggemann at uni-wh.de
Wed Jul 25 08:22:01 EDT 2018
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"
resolve image "redQMark" relative to button "bOne" of me
if it is not empty then
set the hilitedIcon of button "bOne" to the short id of it
resolve image "greenRound" relative to button "bOne" of me
if it is not empty then
set the icon of button "bOne" to the short id of it
"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.
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.
Simon Knight via use-livecode wrote
> Hi Scott,
> Thank you for your replies. I apologise for my question, I should have
> been clearer. However, I have copied your response to my “hints and tips”
> document for reference in the future as it seems like a useful workflow to
> To clarify my question; I have created a simple custom control that uses
> two list fields and some buttons. I will probably want to use the control
> in the future so I am seeking a method of saving the control ready to be
> used in the future. At the moment the png images, I use to "skin" the
> buttons, are stored on a card on a sub-stack named assets. I do this
> because I am following some advice that Trevor Devore gave in a video some
> years ago and I know no better.
> The problem with this storage solution is that my custom control has
> components stored in different locations and they may well become
> separated sometime in the future.
> Initially, I searched the Livecode forum and found a thread where the
> prospect of better encapsulation of custom controls was discussed and Mark
> W. wrote that he was thinking about it. This was a few years ago when
> version 6 was current and I wondered if any features have been added to
> Livecode to enable fully encapsulated custom controls to be written. I
> realise that one answer might be “write a widget” but I don’t really want
> to take time learning a new language and process in an attempt to recreate
> a control that I already have.
> I had not thought of using a customProp to store images and in truth I did
> not know it was an option so I will do some research and see what I can
> Thanks again and best wishes
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
More information about the use-livecode