Editing locked or List fields

Sivakatirswami katir at hindu.org
Mon Jan 3 04:49:00 EST 2011


  Aloha Peter:

Now this what i call a Prime New Year gift!

Sweet.

And, yes, I do work a lot with list fields  and to make lists editable I 
had to add this to your script

       set the listBehavior of the target to not tf

but then this toggles all fields to listbehavior when locked... . so it 
required more....

the problem is you can determine if a field has listbehavior when it is 
set, but if you turn listbehavior off, then one needs a way to preserve 
the fact that this is a list field, even when it's listbehavior is off.

So I added a custom prop to list fields so that they maintain their list 
property thru the editing session.   Perhaps there is a better way, but 
this works:

by adding this to your setProp handler

       if the listbehavior of the target is true then
          set the uList of the target to true
       end if
       if the uList of target = true then
          set the listBehavior of the target to not tf
       end if




On 1/2/11 3:28 AM, Peter Brigham MD wrote:
>
> I use a virtual property:
>
> on mouseup theBtn
>    if theBtn = 1 and "field" is in the target and the \
>               commandkey is down and the shiftkey is down then
>       set the writable of the target to not the writable of the target
>    else
>       pass mouseup
>    end if
> end mouseup
>
> setprop writable tf
>    if "field" is not in the target then exit writable
>    try
       if the listbehavior of the target is true then
          set the uList of the target to true
       end if
       if the uList of target = true then
          set the listBehavior of the target to not tf
       end if
>       set the locktext of the target to not tf
>       set the traversalon of the target to tf
>       set the autohilite of the target to tf
       set the listBehavior of the target to not tf # required for list 
fields
>       --  catch tError
>       --    beep
>       --    answer tError
>    end try
> end writable
>
> getprop writable
>    if "field" is not in the target then return ""
>    try
>       put the locktext of the target into L
>       put the traversalon of the target into T
>       put the autohilite of the target into A
>       if T and A and not L then return true
>       return false
>    end try
> end writable
>
> Put this in a library stack or a frontscript and it will work 
> everywhere -- command-shift-click on any field and toggle the writable 
> of the field. I use it constantly. You can revise this to just toggle 
> the locktext if you work with list fields a lot, so that the usual 
> hiliting and line selection are preserved, locked or unlocked.
>
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig 





More information about the use-livecode mailing list