"Best practice" for creating a custom control

Jérôme Rosat jrosat at mac.com
Tue Nov 2 13:57:51 EDT 2010


Thank you Ken for the link and  the example. Yes, it helps me a lot.

Jerome

Le 1 nov. 2010 à 22:24, Ken Ray a écrit :

> 
> 
>> I'm looking for a kind of "best practice" for creating custom controls. For
>> example, how to access the data of the custom control ? Do we have to use
>> custom properties or a setProp or getProp handlers  or both ? Is it preferable
>> to use a prefix for naming a command ? And for custom properties, do we have
>> to use a set of properties ? With a "standard name" ? Etc.
> 
> You might want to take a look at the budding "standards" document that is in
> development over at the revInterop user group:
> 
> http://tech.groups.yahoo.com/group/revInterop/
> 
> There's a bunch of info there about naming conventions, etc.
> 
> As far as accessing the data is concerned, there isn't really a "best
> practice" yet; getprop/setprop works well in *some* instances, but not in
> others, as does actually using custom properties. For example, I tend to use
> custom properties to store data relative to custom controls I've created,
> and only use getProp/setProp when I want to trigger some kind of visual
> feedback.
> 
> For example, I have a custom control which is a "prompt field" (it's a field
> that shows a custom text string in gray; when the field gets the focus, the
> text goes away so the user can type what they want, and when the field loses
> the focus if there's no text in the field it shows the prompt again). To
> specify what text should be shown as the prompt text, I set the
> uSTSPromptText of the field to a value. If the field is currently showing a
> text prompt, I'd like to change that to the value I'm setting for
> uSTSPromptText, so I have a getProp handler that is triggered to make that
> happen. 
> 
> Hope this helps,
> 
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list