Community widgets

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Community widgets

Post by FourthWorld » Wed Apr 29, 2020 2:37 pm

The DataGrid is a good example of a custom control.

To make your own, put the objects it needs into a group, and set the group's selectGroupedControls property to false. Copy where needed. That's pretty much it.

To simplify maintenance you may want to put most of the group's code into a separate script, and have each instance use that script as its Behavior.

If you plan on using the custom control in multiple projects you may want to store that behavior script in a separate stack file. If you'll be using it in just one app the behavior script can be a substack in your main stack file, or even a button within that stack file.

Experiment with this and report back where we can help with any details.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

giovanni_c
Posts: 44
Joined: Sat Sep 08, 2012 10:50 am

Re: Community widgets

Post by giovanni_c » Tue May 05, 2020 1:40 pm

Hi Richard, thanks for feedback.
I will try what you suggest and will let you know.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Community widgets

Post by FourthWorld » Tue May 05, 2020 3:08 pm

A tip I forgot to include in my last post:

If you have the group adjust the positions of any controls inside it, you may find things much simpler if you see the lockLoc of the group to true.

By default groups will resize themselves to fit their contents, but with the lockLoc on you'll find they stay where you want them while your script adjusts things inside them.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “LiveCode Builder”