Custom Control Design Tutorial

Björnke von Gierke bvg at mac.com
Sat Mar 27 10:18:18 EDT 2010


I'm not sure what would make your "object" not be portable?

the main things to look out for are:

Changing the rectangle or location will of course change some movement dependant scripts. you need to look out for that if you do graphical stuff (like resizing a water level graphic for your tank). 

Use a group, and set its lockLoc to true. Generally It's easier to handle various objects that belong together if they're grouped.

Keep your scripts together.  Group all objects that belong to your "custom" object, and move all "toplevel" scripts into that group's script. 

Try to keep all custom properties in that group too, so that you have one place to go to for setting stuff and calling scripts.

To be able to identify the correct "object" when there's several on one card, I suggest to change the groups name to something unique.

Beyond that, there's really no additional measure to take, unless I misinterpreted your question.

On 27 Mar 2010, at 14:32, Len Morgan wrote:

> Has anyone created a tutorial for creating and using a custom control?  What I'd like to end up with is a custom control that I could copy onto a stack similar to Trevor's Data Grid.  As an example, I've been tasked with redesigning the GUI for a pipeline control system that comprises various tanks, pumps, valves, etc. and I'd like to just create one of each and be able to put multiple instances on a "page" (the system currently uses 6 HUGE monitors hung on the wall of the control room).
> 
> To the a "water tank" as an example, it needs the following:
> 
> It needs to look like a water tank (cylinder of varying hieght) with "water" in it that goes up and down to reflect the amount of water that is actually in the tank.
> 
> A number to show the current level (in feet) that is in the tank.
> Some parameters like tank height, spill height, minimum level with an alarm if the level goes below it.
> A visual indication that it is spilling or has gotten too low.
> 
> I created a little stack and I can do this graphically and I can set variables like currentTankLevel and have it change the number and the "water level" but it's not "portable" so I guess what I'm asking is if there is a tutorial that can tell me how to take this one-off widget I've created and turn it into a custom control/widget that I could copy on to a stack and then "set up" to make that instance unique?
> 
> I know it will probably need behavior scripts and such, and I'm pretty sure all the pieces to do this are laying around in the mail archives somewhere but I was hoping that there was some sort of a step by step guide.
> 
> Any pointers would be welcome.
> 
> len morgan



-- 

official ChatRev page:
http://bjoernke.com?target=chatrev

Chat with other RunRev developers:
go stack URL "http://bjoernke.com/chatrev/chatrev1.3b3.rev"




More information about the use-livecode mailing list