Custom Properties
Dan Shafer
revolutionary.dan at gmail.com
Wed Apr 12 17:49:17 EDT 2006
One important use of setProp in particular comes into play when you create a
library that has values you don't want outside programs/users to change. You
just set up a setProp handler that politely, silently or rudely refuses to
set the property's value. This is an important idea in object-oriented
design.
On 4/12/06, Devin Asay <devin_asay at byu.edu> wrote:
>
>
> On Apr 12, 2006, at 11:44 AM, Thomas McGrath III wrote:
>
> > Does anyone have any examples on the get/setProps in real usage? I
> > have been using custom props but not the setProp etc. I would love
> > some more insightful ideas on it's usage.
>
> The way I use it is much more pedestrian than the Marks'. For me it's
> a really easy way to make sure my interface objects get set to the
> proper states. For example, let's say I want to toggle between an
> 'editable' and 'noneditable' mode for a text editor:
>
> setProp editMode pMode
> if pMode then
> enable button "Save"
> enable button "TextColor"
> set the lockText of fld "myfld" to true
> set the traversalOn of fld "myFld" to true
> else
> disable button "Save"
> disable button "TextColor"
> set the lockText of fld "myfld" to false
> set the traversalOn of fld "myFld" to false
> end if
> pass editMode -- the docs say you have to explicitly pass it to
> have it set the prop
> end editMode
>
> Anyway, this is a crude example, but illustrates how it's been most
> useful to me. There may be several events in my program that could
> trigger a change in edit mode for this field, but in each case all
> I'd have to do would be to
>
> set the editMode of cd "editor" to true ## or false
>
> Devin
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
> _______________________________________________
> 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
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dan Shafer, Information Product Consultant and Author
http://www.shafermedia.com
Get my book, "Revolution: Software at the Speed of Thought"
>From http://www.shafermediastore.com/tech_main.html
More information about the use-livecode
mailing list