Page 1 of 2
How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 10:19 am
by Zax
Hello,
Is there a way to make a text field "copyable" but not editable?
I know this could easily be done with a script attached to a button "Copy" for example, but I prefer to let the user select part of the text, and then use the standard menu item "Copy"... but this field shouldn't be editable, so the user can't modify the field.
In fact, I would like a field like this text you'are reading in your browser: you have the ability to select and copy some characters, but not modify the page's texts.
Thank you.
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 10:34 am
by Klaus
Hi Zax,
just take an ordinary field like "Scrolling field" and only check "Locktext" additionally.
Worked here as advertized: text stays select- and copy-, but not edit-able.
Best
Klaus
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 11:07 am
by Zax
Danke Klaus
I was trying on a label field... My bad.
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 11:12 am
by Klaus
Will also work with a "Label" field, if you check "TraversalOn" and "Autohilite" in the inspector!
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 2:47 pm
by dunbarx
Interestingly, text in a locked field can only be selected by clicking and dragging across the desired string. Double-clicking does not work at all. This can be scripted, though:
Code: Select all
on mouseDoubleDown
select the clickText
end mouseDoubleDown
Craig
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 3:40 pm
by bogs
dunbarx wrote: ↑Wed May 29, 2019 2:47 pm
...text in a locked field can only be selected by clicking and dragging across the desired string.
Say
whaaaa...?

(read the tool tip in that video)
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 4:15 pm
by dunbarx
Bogsy.
I have seen your tutorials. Lovely, all.
It was not obvious to me that one of them in particular addressed this issue. Not sure how I missed that connection.
Craig

Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 5:53 pm
by Zax
Klaus wrote: ↑Wed May 29, 2019 11:12 am
Will also work with a "Label" field, if you check "TraversalOn" and "Autohilite" in the inspector!
You're right, Klaus. "Autohilite" for a field was not obvious.
Thanks dunbarx for the "mouseDoubleDown" tip.
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 8:24 pm
by bogs
dunbarx wrote: ↑Wed May 29, 2019 4:15 pm
Not sure how I missed that connection.
Happens to me all the time. See, what happens is, I get on the 5:15 for Albuquerque, when what I really needed was the 6:20 to St. Joe...

Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 9:32 pm
by dunbarx
dunbarx wrote:
Not sure how I missed that connection.
Happens to me all the time.
Hmmm. We have a failure to communicate. Fortunately, it matters not a whit.
I meant that there was no clue that a video explaining that very thing was lingering nearby. It was not mentioned anywhere earlier in the thread.
It matters not a whit.
Craig
Re: How to make a text field "copyable" but not editable?
Posted: Wed May 29, 2019 10:51 pm
by bogs
That is good, I don't have many wits left

Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 2:39 pm
by kaveh1000
I have filed a suggestion to show the cursor even when field is locked:
https://quality.livecode.com/show_bug.cgi?id=22030
Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 4:32 pm
by dunbarx
I have filed a suggestion to show the cursor even when field is locked:
I understand what you are aiming at, but this would go against typical interface guidelines, I think, if the cursor changed to the usual "iBeam" style. Perhaps a different one?
Craig
Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 5:20 pm
by jacque
I think if the cursor were visible in a locked field, we'd all start getting bug reports about how typing fails.
Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 8:32 pm
by dunbarx
I think if the cursor were visible in a locked field,
Jacque. So you mean any cursor of any kind. I get where you are coming from.
Craig