Source language: Translate to:

Mantener el Foco en una entrada de Texto

General questions about NeoBook

Moderator: Neosoft Support

Mantener el Foco en una entrada de Texto

Postby ecueto » Sun Jul 23, 2017 1:52 am

Hola amigos.
Otra vez estoy por aquí.
Quería preguntaros ¿como puedo mantener el foco en una entrada de texto).
Estoy utilizando un objeto timer para crear un contador y cuando ejecuto el timer pierdo el foco en las entradas de texto.

El objeto timer utiliza la función: InternetPost para enviar datos a un servidor WEB y creo que es esta función la que hacer perder el foco a las entradas de texto.

He utilizado en las entradas de texto una variable para poner el nombre del objeto y en el timer:
FocusObject "[NombreObjeto]"
SendKeys "" "{CtrlDn}{End}{CtrlUp}"

Para que pueda volver a dar foco a la entrada de texto pero no consigo que se mantenga en la posición en la que escribo, puedo hacer que sendkeys vaya al final o al principio del texto pero no que se mantenga donde estoy escribiendo.

¿Se pude hacer algo sin ralentizar el Timer (Es un cronometro que me da en pantalla una cuenta hacia atrás de un segundo)?

Muchas gracias por vuestra ayuda.

E.cueto
---
Hello friends.
I'm here again.
I wanted to ask you how can I keep the focus on a text entry).
I am using a timer object to create a counter and when I run the timer I lose focus on the text inputs.

The timer object uses the function: InternetPost to send data to a WEB server and I think it is this function that causes the focus to be lost to the text inputs.

I used in the text inputs a variable to put the name of the object and in the timer:
FocusObject "[ObjectName]"
SendKeys "" {CtrlDn} {End} {CtrlUp} "

So that I can focus again on text input but I can not keep it in the position where I write, I can have sendkeys go to the end or the beginning of the text but not to stay where I am writing.

Could you do something without slowing down the timer (Is it a timer that gives me an account backwards for a second)?

Thank you very much for your help.

E.Cueto
Last edited by ecueto on Sun Jul 23, 2017 8:22 am, edited 1 time in total.
ecueto
 
Posts: 26
Joined: Sat Jun 07, 2014 12:04 am

Re: Mantener el Foco en una entrada de Texto

Postby Gaev » Sun Jul 23, 2017 5:59 am

ecueto:

You can use GetObjectInfo and CursorPosition (for parameter "info type") to capture/save the position of the Cursor in your Text Entry box ... then, you can use SendKeys ({Right} inside a Loop/EndLoop code block) to advance the Cursor from the {Home} position to the "previously captured" position.

P.S. When posting in an English forum, it is courteous to provide "English translations of your postings".
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Mantener el Foco en una entrada de Texto

Postby ecueto » Sun Jul 23, 2017 8:23 am

Thanks Gaev.
Sorry about the translation

E.Cueto
ecueto
 
Posts: 26
Joined: Sat Jun 07, 2014 12:04 am

Re: Mantener el Foco en una entrada de Texto

Postby ecueto » Wed Aug 02, 2017 9:52 am

Thanks for the help.
I'm trying to prove what it suggests but I have a problem.
I have a multiline text entry, I capture the keyboard position for example the 3500, apart from taking a lot in executing the loop does not go to the indicated position.
I have found that it is a bit of a mess with the carriage returns.
Is there any possibility of going to the exact position?
Any plugins?

Thank you very much for your help.
-----

Gracias por la ayuda.
estoy tratando de probar lo que me sugiere pero tengo un problema.
Tengo una entrada de texto multilinea, capturo la posición del teclado por ejemplo la 3500, a parte de tardar un montón en ejecutar el bucle no va a la posición indicada.
He comprobado que se hace un poco de lío con los retornos de carro.
¿Existe alguna posibilidad de ir a la posición exacta?
¿algún plugin?

Muchas gracias por vuestra ayuda.

E.Cueto
ecueto
 
Posts: 26
Joined: Sat Jun 07, 2014 12:04 am

Re: Mantener el Foco en una entrada de Texto

Postby Gaev » Thu Aug 03, 2017 6:51 am

eceuto:

When you have a "multi-line" TextEntry Box, it gets complicated ... each "new-line" (created when you press the Enter key) is saved as [#13][#10] (i.e. 2 invisible characters).

Since you also have concerns about the speed with which a Loop/EndLoop of over 3500 characters is serviced, you might try another approach ...

1) Use {Home} in SendKeys

2) Use {Down} in SendKeys ... check the [newCusrorPosition]

3) If [newCursorPosition] is greater than [savedCursorPosition], use {Up} in SendKeys and continue with step (4) ... else repeat step (2)

4) Use {Right} in SendKeys ... check the [newCusrorPosition] ...

5) If [newCursorPosition] is greater than [savedCursorPosition], use {Left} in SendKeys and stop ... else repeat step (4)

Possible, but you will need additional code to allow for all possible conditions (e.g. cursor at Home position or at one of the "end-of-line" positions etc.) ... should still be serviced faster than one {Right} at a time.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Mantener el Foco en una entrada de Texto

Postby ecueto » Thu Aug 03, 2017 7:30 am

thanks again.
I'll try it

E.Cueto
ecueto
 
Posts: 26
Joined: Sat Jun 07, 2014 12:04 am

Re: Mantener el Foco en una entrada de Texto

Postby ecueto » Thu Aug 03, 2017 10:07 am


Thanks Gaev
I've been testing and your suggestion is perfect.

I made a modification for when we are in the last line and can no longer do a {down}, it stays in loop.
I've also deleted the last step (use {Left} in SendKeys and stop)

I do not know if it is correctly programmed but it works right now.

Thanks Gaev



.- GAEV Prueba

...
GetObjectInfo "TodoTextos" "CursorPosition" "[puntero]"
SetVar "[NEWpuntero]" ""
FocusObject "TodoTextos"
SendKeys "" "{CtrlDn}{home}{CtrlUp}"

While "[NEWpuntero]" "<" "[puntero]"
FocusObject "TodoTextos"
SendKeys "" "{Down}"
GetObjectInfo "TodoTextos" "CursorPosition" "[NEWpuntero1]"
If "[NEWpuntero]" "=" "[NEWpuntero1]"
ExitWhile
else
SetVar "[NEWpuntero]" "[NEWpuntero1]"
endif
endwhile

FocusObject "TodoTextos"
SendKeys "" "{Up}"
GetObjectInfo "TodoTextos" "CursorPosition" "[NEWpuntero]"

While "[NEWpuntero]" "<" "[puntero]"
FocusObject "TodoTextos"
SendKeys "" "{Right}"
GetObjectInfo "TodoTextos" "CursorPosition" "[NEWpuntero]"
endwhile
ecueto
 
Posts: 26
Joined: Sat Jun 07, 2014 12:04 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests