Custom Properties
David Burgun
dburgun at dsl.pipex.com
Thu Apr 13 05:55:07 EDT 2006
Hi,
I don't see what is to be gained using setProp's in this example?
Surely:
function setEditMode 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
end setEditMode
---------------
get setEditMode(true/false)
Would do the same job with less lines of code and be much easier to
follow?
All the Best
Dave
On 12 Apr 2006, at 22:26, Devin Asay wrote:
> 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
More information about the use-livecode
mailing list