Widget vs group

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Widget vs group

Post by MaxV » Thu Aug 27, 2015 4:27 pm

Hello everybody,
is widget useful for developers?
For what I see, widget purpose is to send an unchangeable control to another developer. Moreover is longer to code, debug and see it in action.
I see a lot of hype from livecode company about widget, but I think that it is the less requested feature that the standard livecode user needs.
I think that user can create the same control with groups and in less time.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Widget vs group

Post by trevordevore » Thu Aug 27, 2015 4:50 pm

Hi @MaxV,

I've been writing widgets for some months now for a project and here are some of my thoughts. Note that when I refer to a custom control I am referring to a control that is a group composed of other LiveCode controls. Also note that I haven't experimented with widgets or libraries that make calls to C/C++/Cocoa libraries. That feature is a huge plus as well.

I think widgets are a huge step forward for developers.

1) If you change the look of a widget, it changes every instance of the widget in your application. If you were to add a control to a custom control you would have to do it manually (or create some kind of updater script) for every instance of the control.

2) You can define actual properties on widgets. In addition to being able to refer to these properties in script, the LiveCode IDE automatically generates a UI in the Property Inspector to interact with these properties. For custom controls you are defining custom properties that are fragile due to lock message concerns. You would have to manually create your own visual tool for setting properties.

3) You have much more control over the look of the widget. You can use SVG path data, SKIA drawing routines, etc. to draw the exact shape you want. Tab controls are a snap, custom buttons with odd shapes are a snap. Since it is all vector, the widget looks fantastic at any resolution. You are much more limited when trying to combine custom controls.

4) A widget is a single control to LiveCode. You can hide a lot of complexity behind that single control and it isn't possible to break it by accidentally ungrouping it, removing a control from within it, etc. Custom controls are fragile, especially if you are distributing them for other developers to work with.

While it is a little more work to create a widget at first, it gets easier with practice. I imagine LiveCode will further refine this process as Widgets mature. In the end we have a control that is more powerful, less fragile, and more user friendly.

Here is a short list of widgets I've created for my project that I feel were easier and/or gave a better end result than I would get a custom control. Note that anywhere I refer to icons I am using SVG path data (created in Illustrator) so that they scale perfectly on any display. All other drawing uses the LiveCode Builder drawing routines so they scale as well.

* Button with text and icons
* Button with text, icons, and a drop-down menu
* Animated progress indicators
* Animated busy indicators
* Rectangle graphic that gives control over visibility, color, and padding of the border on each side
* Color swatch control
* Tab control
* Toolbar tool selector control
* Checkbox with custom look and feel
* A control that generates a mixture of text and icons based on a user selection.
* Segmented control for selecting text alignment or types of arrowheads to display
* Custom slider control
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply

Return to “LiveCode Builder”