Control of Text Fields.
irog at mac.com
Thu Nov 4 21:39:48 EDT 2021
Thanks, Alex. Sorry I didn’t make myself clear. I’m building a calculator stack with forward and back arrow buttons and a Delete button. What's the script for these buttons?
> On Nov 4, 2021, at 5:53 PM, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
> Hi Roger,
> I'm not sure I properly understand your question.
> here's a code snippet the moves the insertion point (in this sample, typing an 'f' moves it forward, 'b' moves it back). (Note this also works if there is some text selected - it moves the insertion to just after the selection, just like the arrow key does).
>> on keydown p
>> local t
>> switch p
>> case "f"
>> put word 4 of the selectedchunk into t
>> select after char (t+1) of me
>> case "b"
>> put word 2 of the selectedchunk into t
>> select before char (t-1) of me
>> end switch
>> end keydown
> To then delete the char in front of it, you'd do something like
> put empty into char (t+1) of me
> Hope that's close enough to what you were asking, or at least gives you a starting place :-),
> On 04/11/2021 20:49, Roger Guay via use-livecode wrote:
>> I simply want to be able to move the insertion iBeam in a focused field left and right, one char at a time (just like the left and right arrows keys), and then to delete the char in front of it (just like the Delete key). The dictionary was again of no use to me. Can someone please provide sample scripts?
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode