Autocomplete

165 views
Skip to first unread message

PacMan Programador

unread,
Jan 20, 2019, 12:08:03 PM1/20/19
to DroidScript
Tengo una pregunta, mi problema es que yo estoy creando una app de editor de código HTML, que por cierto felicitaciones con esta app, bueno, el punto es que yo quiero añadir la función de autocompleteauto, y ya tengo que filtre resultados en una lista, pero no sé cómo hacer para que al momento de escribir o dejar un espacio se reinicie para dar más resultados, porque sino sigue buscando el mismo resultado y no encuentra nada, me gustaría que respondieran

BareK

unread,
Jan 20, 2019, 12:16:40 PM1/20/19
to DroidScript
I'm not sure to get what you're asking.
Would you mind to provide some code? (very minimal)

BareK

unread,
Jan 21, 2019, 7:10:09 AM1/21/19
to DroidScript

PacMan Programador

unread,
Jan 21, 2019, 9:35:38 AM1/21/19
to DroidScript
Lo que yo quiero lograr en un autocompletado como el de droidscript, al escribir este símbolo "<" salgan los posibles resultados,
Message has been deleted
Message has been deleted

BareK

unread,
Jan 21, 2019, 12:13:21 PM1/21/19
to DroidScript
I try to answer you but my messages get deleted instantly (maybe am I considered as spam?)
Message has been deleted

BareK

unread,
Jan 21, 2019, 12:19:11 PM1/21/19
to DroidScript
Apparently I can't post code directly (this is new?).
So I'll attach a spk to this post.
This is an adataption of Jorge Ramirez sample.
Not perfect, but a good proof of concept to show you how you can perform this.
AutoCompletion.spk

PacMan Programador

unread,
Jan 21, 2019, 1:44:11 PM1/21/19
to DroidScript
Muchas muchas gracias eso estaba buscando enserio muchas gracias!!!!! 1 estrella pa ti

PacMan Programador

unread,
Jan 21, 2019, 2:24:47 PM1/21/19
to DroidScript
Una última pregunta, me sirvio mucho tu código, si ti no hubo logrado nada, y solo quería saber si hay manera de borrar lo que antes se escribe, porque cuando escribo "<h" me salen los resultados h1, al h6, pero si no lo borro se queda así "<hh1></h1>" hay manera de solucionarlo?
Message has been deleted

BareK

unread,
Jan 21, 2019, 3:16:13 PM1/21/19
to DroidScript
Update lst_OnTouch function like this:

var text = txt.GetText();
var tag = item + '></' + item + '>';
    
var index = text.lastIndexOf( "<" );
var diff = text.length - index;
text 
= text.substr( 0, index + 1 );
    
//I write the touched item to the textedit
txt
.SetText( text + tag );
    
//Update cursor position
var pos = txt.GetCursorPos();
var newPos = pos + item.length + 1 - diff + 1;
txt
.SetCursorPos( newPos );

Note that this is really a proof of concept.
It only allow the usage of autocompletion if "<" is the very last character of the text field.
A real implementation would allow to open autocompletion each time you set your cursor after a "<", regardless of it's position.
But it would require a different approach and some additional work.

I hope this samples will inspire you to do achieve what you're looking for.

PacMan Programador

unread,
Jan 21, 2019, 9:33:35 PM1/21/19
to DroidScript
Te mereces todo!!! Si te pudiera dar 1 dólar te lo daría :v

PacMan Programador

unread,
Jan 22, 2019, 2:16:27 PM1/22/19
to DroidScript
Hay manera de solucionar que cuando escribo dentro de dos etiquetas no me sale el autocomplete?
Ayudame por favor
Por ejemplo
<h1>aqui no sale el autocompletado</h1>
Y aquí si

Porque dentro no sale?

BareK

unread,
Jan 23, 2019, 1:06:16 PM1/23/19
to DroidScript
You'll have to do it on your own.

I'll juste quote my previous post:

"Note that this is really a proof of concept.
It only allow the usage of autocompletion if "<" is the very last character of the text field.
A real implementation would allow to open autocompletion each time you set your cursor after a "<", regardless of it's position.
But it would require a different approach and some additional work.

I hope this samples will inspire you to do achieve what you're looking for."

If you tried things and face specific errors or difficulties, post your code and maybe we'll be able to help you :)
Reply all
Reply to author
Forward
0 new messages