move cursor to the end of a line in a field

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

move cursor to the end of a line in a field

Rick Harrison via use-livecode
I need to position the cursor at the end of the contents of a single line
field.  This can be "manually" done by pressing the "END" key while the
cursor is in that field.  I want to do that positioning programmatically...
but ...

I've searched all of the "...KeyDown" message options (e.g. commandKeyDown,
controlKeyDown, optionKeyDown) and the other "key" message options (e.g.
functionKey) and cannot find one which will tell me what the "END" key is...
a Windows resource tells me it is "35"....

"rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
value to the active field?  Or, ideally, can someone tell me how to
"emulate" the "END" key and position the cursor at the end of the contents
of a single line field?

Likely simple but I just can't work it out.  Thanks in advance!

Douglas Ruisaard
           
    Trilogy Software
      (250) 573-3935




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
Douglas,

you can use

select after line x of fld y

for this.
For example to place the cursor after line 3 of fld "text" you would write

select after line 3 of fld "text"


Regards,

Matthias


-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 23.12.2020 um 20:57 schrieb Douglas A. Ruisaard via use-livecode <[hidden email]>:
>
> I need to position the cursor at the end of the contents of a single line
> field.  This can be "manually" done by pressing the "END" key while the
> cursor is in that field.  I want to do that positioning programmatically...
> but ...
>
> I've searched all of the "...KeyDown" message options (e.g. commandKeyDown,
> controlKeyDown, optionKeyDown) and the other "key" message options (e.g.
> functionKey) and cannot find one which will tell me what the "END" key is...
> a Windows resource tells me it is "35"....
>
> "rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
> value to the active field?  Or, ideally, can someone tell me how to
> "emulate" the "END" key and position the cursor at the end of the contents
> of a single line field?
>
> Likely simple but I just can't work it out.  Thanks in advance!
>
> Douglas Ruisaard
>
>    Trilogy Software
>      (250) 573-3935
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
select char (the number of chars in field 1)+1 to -1 of field 1

Sent from my iPhone

> On Dec 23, 2020, at 2:58 PM, Douglas A. Ruisaard via use-livecode <[hidden email]> wrote:
>
> I need to position the cursor at the end of the contents of a single line
> field.  This can be "manually" done by pressing the "END" key while the
> cursor is in that field.  I want to do that positioning programmatically...
> but ...
>
> I've searched all of the "...KeyDown" message options (e.g. commandKeyDown,
> controlKeyDown, optionKeyDown) and the other "key" message options (e.g.
> functionKey) and cannot find one which will tell me what the "END" key is...
> a Windows resource tells me it is "35"....
>
> "rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
> value to the active field?  Or, ideally, can someone tell me how to
> "emulate" the "END" key and position the cursor at the end of the contents
> of a single line field?
>
> Likely simple but I just can't work it out.  Thanks in advance!
>
> Douglas Ruisaard
>
>    Trilogy Software
>      (250) 573-3935
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
To improve on my initial suggestion...

select after char -1 of field 1

Sent from my iPhone

> On Dec 23, 2020, at 3:22 PM, matthias rebbe via use-livecode <[hidden email]> wrote:
>
> Douglas,
>
> you can use
>
> select after line x of fld y
>
> for this.
> For example to place the cursor after line 3 of fld "text" you would write
>
> select after line 3 of fld "text"
>
>
> Regards,
>
> Matthias
>
>
> -
> Matthias Rebbe
> Life Is Too Short For Boring Code
>
>> Am 23.12.2020 um 20:57 schrieb Douglas A. Ruisaard via use-livecode <[hidden email]>:
>>
>> I need to position the cursor at the end of the contents of a single line
>> field.  This can be "manually" done by pressing the "END" key while the
>> cursor is in that field.  I want to do that positioning programmatically...
>> but ...
>>
>> I've searched all of the "...KeyDown" message options (e.g. commandKeyDown,
>> controlKeyDown, optionKeyDown) and the other "key" message options (e.g.
>> functionKey) and cannot find one which will tell me what the "END" key is...
>> a Windows resource tells me it is "35"....
>>
>> "rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
>> value to the active field?  Or, ideally, can someone tell me how to
>> "emulate" the "END" key and position the cursor at the end of the contents
>> of a single line field?
>>
>> Likely simple but I just can't work it out.  Thanks in advance!
>>
>> Douglas Ruisaard
>>
>>   Trilogy Software
>>     (250) 573-3935
>>
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
off the top of my head, select char -1 to -1 of the focusedObject (or me if in the script of the field itself). Trouble is I am trying this in the field script itself and it doesn’t work, but if I enter select char -1 to -1 of field 7 in the message box it DOES work.

Bob S


> On Dec 23, 2020, at 11:57 AM, Douglas A. Ruisaard via use-livecode <[hidden email]> wrote:
>
> I need to position the cursor at the end of the contents of a single line
> field.  This can be "manually" done by pressing the "END" key while the
> cursor is in that field.  I want to do that positioning programmatically...
> but ...
>
> I've searched all of the "...KeyDown" message options (e.g. commandKeyDown,
> controlKeyDown, optionKeyDown) and the other "key" message options (e.g.
> functionKey) and cannot find one which will tell me what the "END" key is...
> a Windows resource tells me it is "35"....
>
> "rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
> value to the active field?  Or, ideally, can someone tell me how to
> "emulate" the "END" key and position the cursor at the end of the contents
> of a single line field?
>
> Likely simple but I just can't work it out.  Thanks in advance!
>
> Douglas Ruisaard
>
>    Trilogy Software
>      (250) 573-3935
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode



-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 23.12.2020 um 21:26 schrieb Brian Milby via use-livecode <[hidden email]>:
>
> To improve on my initial suggestion...
>
> select after char -1 of field 1
>
or to improve your 2nd suggestion..

select after fld 1  

would do the same. ;)

> Sent from my iPhone
>
>> On Dec 23, 2020, at 3:22 PM, matthias rebbe via use-livecode <[hidden email]> wrote:
>>
>> Douglas,
>>
>> you can use
>>
>> select after line x of fld y
>>
>> for this.
>> For example to place the cursor after line 3 of fld "text" you would write
>>
>> select after line 3 of fld "text"
>>
>>
>> Regards,
>>
>> Matthias
>>
>>
>> -
>> Matthias Rebbe
>> Life Is Too Short For Boring Code
>>
>>> Am 23.12.2020 um 20:57 schrieb Douglas A. Ruisaard via use-livecode <[hidden email]>:
>>>
>>> I need to position the cursor at the end of the contents of a single line
>>> field.  This can be "manually" done by pressing the "END" key while the
>>> cursor is in that field.  I want to do that positioning programmatically...
>>> but ...
>>>
>>> I've searched all of the "...KeyDown" message options (e.g. commandKeyDown,
>>> controlKeyDown, optionKeyDown) and the other "key" message options (e.g.
>>> functionKey) and cannot find one which will tell me what the "END" key is...
>>> a Windows resource tells me it is "35"....
>>>
>>> "rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
>>> value to the active field?  Or, ideally, can someone tell me how to
>>> "emulate" the "END" key and position the cursor at the end of the contents
>>> of a single line field?
>>>
>>> Likely simple but I just can't work it out.  Thanks in advance!
>>>
>>> Douglas Ruisaard
>>>
>>>  Trilogy Software
>>>    (250) 573-3935
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
On 12/23/20 12:26 PM, Brian Milby via use-livecode wrote:
> To improve on my initial suggestion...
>
> select after char -1 of field 1

That's the end of the *field* not the *line*.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode

-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 23.12.2020 um 21:50 schrieb Mark Wieder via use-livecode <[hidden email]>:
>
> On 12/23/20 12:26 PM, Brian Milby via use-livecode wrote:
>> To improve on my initial suggestion...
>> select after char -1 of field 1
>
> That's the end of the *field* not the *line*.

But it would work, because Douglas wrote that it is a single line field.

>
> --
> Mark Wieder
> [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode


> 23. des. 2020 kl. 20:57 skrev Douglas A. Ruisaard via use-livecode <[hidden email]>:
>
> "rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
> value to the active field?  Or, ideally, can someone tell me how to
> "emulate" the "END" key and position the cursor at the end of the contents
> of a single line field?

You could try this in the field script:

on rawKeyDown theKey
   if theKey = 65367 then
      select after me
   else
      pass rawKeyDown
  end if
end rawKeyDown

This will allow the normal behavior for all other keys when the field is active.

Best regards
Tore Nilsen
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
And if you have a multiline field and would like to go to the end of the current line use this:

on rawKeyDown theKey

if theKey = 65367 then

put word 2 of the selectedLine of me into tLine

select after line tLine of me

else

pass rawKeyDown

end if

end rawKeyDown


> 23. des. 2020 kl. 22:49 skrev Tore Nilsen via use-livecode <[hidden email]>:
>
>
>
>> 23. des. 2020 kl. 20:57 skrev Douglas A. Ruisaard via use-livecode <[hidden email]>:
>>
>> "rawKeyDown" tells me the raw key is 65367 ... but how do I "send" a rawkey
>> value to the active field?  Or, ideally, can someone tell me how to
>> "emulate" the "END" key and position the cursor at the end of the contents
>> of a single line field?
>
> You could try this in the field script:
>
> on rawKeyDown theKey
>   if theKey = 65367 then
>      select after me
>   else
>      pass rawKeyDown
>  end if
> end rawKeyDown
>
> This will allow the normal behavior for all other keys when the field is active.
>
> Best regards
> Tore Nilsen
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: move cursor to the end of a line in a field

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
On 12/23/20 12:57 PM, matthias rebbe via use-livecode wrote:

>> That's the end of the *field* not the *line*.
>
> But it would work, because Douglas wrote that it is a single line field.

Ah. I just assumed it was a bit of mistyping and should have been

"single line of a field"

...and yes, I know what they say about assuming... <g>

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode