how to create a Custom Control

Sannyasin Brahmanathaswami brahma at hindu.org
Wed Apr 27 16:11:02 EDT 2016


On 4/27/16, 5:38 AM, "use-livecode on behalf of Richard Gaskin" <use-livecode-bounces at lists.runrev.com on behalf of ambassador at fourthworld.com> wrote:



>A custom control is just a group of other controls put together to 
>provide something, well, custom.


I would like to take this one step further if that does not overstep the scope of this thread:

How easy or hard, is it to take such a group and turn it into a widget?

I.e. Text based. And, would that be better or not and why?

Is there an online repository of widget examples? 

Of course you might think this is over kill since why waste time doing an lcb “thing” to create binary objects that are easier done in the IDE/GUI… But then, you have the binary control and the external behavior script.. .
Where as a widget is 100% self-contained; and some small groups I have in front of me, that I’m currently replicating across many cards are super simple:

group: 
Name: [Some Group Acting As Big Button/many copies in the UI]
Bkgnd grc; params: color, rect, radius
1 text field; params: fonts size, style and position
1 image; params: rect + path to image on disk

On mouseup script

How hard would that be to describe as an lbc/widget text object? dunno, me thinks pretty easy...

Musings:

I’m still trying to wrap my head around the use cases where a widget will be clearly superior architecture.
The GIT version control immediately comes to mind… because the binary control as a native LC object will have to be contained in a stack of some sort. As such it lives outside GIT control options. Perhaps there are other reasons.

E.g. common bottom tab/tool bar on an app with several icons, that needs needs to be incorporated into X number of separate stacks… kinda shouts out “Widget!”


Thoughts?

BR


More information about the use-livecode mailing list