Page 2 of 2
Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 8:36 pm
by bogs
I thought of that myself Jacque (scary, isn't it?

) but, I also see two similar instances where it goes either way outside of Lc.
*IF* you have the Thunderbird mail client, for instance, and have an rss feed setup in it, and you click in the text of a feed, you get no cursor like what is proposed, and that is expected as Craig mentioned.
However, if you also have Firefox, and you come here to say, post a reply, and you click in the text of the topic review area below the reply field, you *do* see a cursor

- confusing, isn't it?
So, in 2 different programs by the same group of dev's (more or less) you have 2 different behaviors where the cursor is concerned in a locked field.
*Edit - I should point out that FF also displays that cursor if you are just reading a thread, and click in the middle of any text on the page.
Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 9:49 pm
by kaveh1000
My use case is that I want to be able to move around a field, highlight text using arrow keys and shift key etc, and pressing a key or button to set off an action, for instance:
• Copy text to another field
• Change the backgroundcolor of selection
• etc
But not be able to change the text.
Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 10:48 pm
by dunbarx
Kaveh.
Cummon. Make this more fun.
In a locked field with some text:
Code: Select all
on mouseMove x,y
if the mouseLoc is within the rect of me then select the mouseText
end mouseMove
on mouseUp
set the clipboardData to the mouseText
end mouseUp
I can think of lots more additional gadgetry to make all your dreams come true.
Craig
Re: How to make a text field "copyable" but not editable?
Posted: Thu May 30, 2019 11:06 pm
by kaveh1000
Thanks Craig. Just when I think I have seen all the magic that LiveCode can come up with you give me new ones.
I also need to be able to see cursor so that shift right selects next char.
Actually the first approach I tried was to use an unlocked text, but stop changes to it with a number of handlers, e.g.
Code: Select all
on deletekey
exit deletekey
end deletekey
on backspacekey
exit backspacekey
end backspacekey
Perhaps that is a better approach to take...
Re: How to make a text field "copyable" but not editable?
Posted: Fri May 31, 2019 3:05 pm
by dunbarx
Well, you can:
Code: Select all
on mouseEnter
set the cursor to iBeam
lock cursor
But you will bump into the interface guidelines, as Jacque and I discussed above.
And you can select the actual character the mouse is hovering over with;
Code: Select all
if the mouseLoc is within the rect of me then select char word 2 of the mouseCharchunk of me
If you only determine what char that is, whether selected or not, you can use that information to allow an arrowKey to select either of its neighbors.
Cummon. Have some fun
Craig