Search Bar

I wanna make a search bar for 21 names (for now), and im wondering if i could do it somehow faster den tipping every letter like
If "Attribute is V" then bring this pictures at the front
If "Attribute is Ve" then bring this pictures at the front

Its gonna take some really long time if i need to seperate every letter like that. Hope someone of you has an idea. Thanks and good night :blush:

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited June 2016

    It sounds like you're wanting to do a "live" search similar to how OS X Spotlight works. It's possible to do this but I think you'd need to run a tableSearch() each time the input value changes (e.g. from "V" to "Ve"). The main problem you're going to run into is that tableSearch() only returns the first value that matches. So if you have this in your table rows...

    Veronica
    Velvet
    Venice

    ...and you search for "Ve", you're always only going to get back the table row with Veronica in it.

    Edit: also, tableSearch doesn't differentiate between the start, middle, or end of a text string. So if you want to be sure it's finding "Veronica" and not "Marvelous" when you search for "Ve", you need to setup your table like this...

    #Veronica
    #Velvet
    #Venice

    ...and then search for "#Ve" by using "#"..self.searchTerm

    The pound/hashtag symbol can be anything you like (e.g. !, @, $, etc.).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • fmakawafmakawa Member Posts: 565

    @tatiang @jovanovic_dejan this is also being done using a custom keyboard and not the input text function? Since the input text function would cover the whole screen and wouldn't permit a live search.
    Wouldn't the looping over table function allow return multiple values of 've' rather than just the first instance?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @fmakawa Yes, you'd need to use a custom keyboard. And yes, good point about Loop over Table for returning multiple results.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.