How do I use a textbox to search for some names (text)?

0 favourites
  • 6 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • Hey guys,

    I try to create a search system without luck.

    I want to use 1 text and 1 textbox. Each time i start writing to detect the text characters from left and appear the right text names.

    I don't want to delete and create the texts each time i search. A visible-invisible method is needed.

    Any ideas, can you please help me?

    Thanks again all!

  • There is no single or "best" way to do that. For a barebone way to do it, this is pretty much it :

  • Thank you Magistross for your help, I appreciate it! :)

    Just a question:

    I check the project so if i understand right, each time you clear all text and replace the names for each starting from left to right, yes?

    So my question is, what can i do, if i want to use the text names but this time to use visible and position methods? But not to use any destroy. Can i?

    I mean, imagine the 4 text to have unique variables (Instance variables) - Why not to get from array.

    So for example:

    Text 1 = John = 100

    Text 2 = Bill = 50

    Text 3 = Jason = 10

    Text 4 = Anna = 30

    So back on your example, when i search for "J" letter,

    The project keep on Text 1 "John" but this time in Text 2 with "Bill" and "50" variable give the name "Jason".

    Hope you understand my point. Thanks again!

    P.S: Yes i know, maybe you can create something with Y for array and give on text a rename for names and variables. But i ask in case not use this way (rename) and to use a move/position method.

  • Since we recycle the text objects, it might be best if additionnal data associated with the names are decoupled from them. In my example, I would use the array to do so, by turning it into a 2D Array.

    edit : Just realized you wanted to stay away from the array, I updated the example to work directly with the text objects.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's another idea too. The crux is a compare like the following to see if any of the text matches what was typed.

    compare textbox.text = left(text.text, len(textbox.text))

    And then I realized some simplifications:

  • R0J0hound

    Thank you my friend! Nice idea!!! :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)