Editing locked or List fields

Peter Brigham MD pmbrig at gmail.com
Sun Jan 2 08:28:41 EST 2011


On Jan 1, 2011, at 5:26 PM, Sivakatirswami wrote:

> I'm all the time editing locked or list fields or fields where the  
> traversal is off.
>
> The "onerous" method is of course to switch to the select tool,  
> double click on the fld; choose Contents from the drop down menu,  
> resize the window if you need to see more of the contents... edit  
> contents
>
> Before i cook up my own widget, which would not be hard to do, I was  
> wondering what do the rest of you do?
>
> OT: is tRev working, bug-free, with the latest versions of LiveCode?
>
> Sivakatirswami

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
       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
       --  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