Allow navigation in field but prevent editing

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Allow navigation in field but prevent editing

Post by kaveh1000 » Sat Apr 27, 2019 9:09 pm

Kaveh

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Allow navigation in field but prevent editing

Post by bogs » Sat Apr 27, 2019 9:14 pm

jacque wrote:
Sat Apr 27, 2019 6:05 pm
I was thinking of something like bogs suggested. The pasteKey function has been iffy for years, but you can trap commandKeyDown and only pass the message if the key is C.
Erm well, if the field is unlocked so he has a cursor, he'd have to intercept/drop more than just the [CTRL/CMD + 'C'] keys, which is why I mentioned rawKey, prefereably in the 'rawKeyDown' handler. Basically, you'd let ctrl/cmd and if that is pressed in combo with 'c' then you pass it, but drop everything else while the field has focus.

Otherwise, you might have someone get a space or a whole bunch of letters in, or out if they backspace, etc. The kludge I mentioned worked out surprisingly well in my tests, passing the copy to the other field. However, it is just as easy to leave the original field unlocked and proceed the same way.

I added this comment right below your report -
I'd further suggest restricting showing the cursor if transversal is off, so it behaves as it currently does, since at that point, the field isn't supposed to have the ability to do any of the things mentioned.
Image

Post Reply