How do I display result based on typed alphabet in drop down list in real time?

0 favourites
  • 11 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hi Friends,

    Need help in creating a drop down list where user types one word and relevant rows with that alphabet is shown in results. You might have seen this in various search boxes and google search bar. As u type one word, results start appearing in drop down listing. Is it possible in construct 2 drop down list?

    Regards,

  • I think you need to use two objects - TextBox and List.

    In "TextBox On Text Changed" event you can refresh the list of items for the List. For example, if you keep these strings in an array, you need to clear the list, then loop through the array and check if

    lowercase(left(Array.At(loopindex), len(TextBox.text))) = lowercase(TextBox.text)

    If this expression is true, add this string to the list.

  • I think you need to use two objects - TextBox and List.

    In "TextBox On Text Changed" event you can refresh the list of items for the List. For example, if you keep these strings in an array, you need to clear the list, then loop through the array and check if

    lowercase(left(Array.At(loopindex), len(TextBox.text))) = lowercase(TextBox.text)

    If this expression is true, add this string to the list.

    Thanks for reply dop. Actually i m trying this without array bcz I dont understand array so i try to find alternate and sometimes it go long route. I am sharing what I have done. vserv-images.s3.amazonaws.com/adsunit/capx/search.capx this is the file. If we can do this only by array, then can you help me with the example may be it will help me and start loving arrays. Thanks for the support dop.

    Regards,

    jatin

  • Here you go:

    dropbox.com/s/9esvuvpfsnri46n/SearchableList.capx

    .

    Don't be scared by JSON, it's just an easy and compact way to quickly fill the array with lots of values. You can use other methods, for example "Array Insert" action.

  • Here you go:

    https://www.dropbox.com/s/9esvuvpfsnri46n/SearchableList.capx?dl=0

    .

    Don't be scared by JSON, it's just an easy and compact way to quickly fill the array with lots of values. You can use other methods, for example "Array Insert" action.

    Thanks for the encouragement dop. Will definitely think like that going forward. The link you shared, I am unable to download it shows loading loading only capx is never downloaded. Can you mail me zip on 'ancientmailsyrn@gmail.com'.

    That will be very helpful.

    Regards,

    Jatin

  • Here you go:

    https://www.dropbox.com/s/9esvuvpfsnri46n/SearchableList.capx?dl=0

    .

    Don't be scared by JSON, it's just an easy and compact way to quickly fill the array with lots of values. You can use other methods, for example "Array Insert" action.

    Hi Dop, thanks for sharing CAPX. I loved the way u did for array. Found it clean and cute and less scary. Also, want to point out that the shared capx is giving result bit differently. I was trying to implement the solution like we see in google search bar omnibox. We type a word or alphabet and matching to that 10 items gets listed of the list. Is it possible to display that list? If yes how should I do with the array you helped me to create. Thanks in advance. U are a nice guy and god bless you.

  • I don't understand, could you give an example with that list of fruits? When I type "ap" in the textbox, what should come up in the list? Top 10 fruits starting with "ap" (apple and apricot)? Or top 10 fruits containing "ap" anywhere in their name (for example, papaya and pineapple)? Or something else?

  • I don't understand, could you give an example with that list of fruits? When I type "ap" in the textbox, what should come up in the list? Top 10 fruits starting with "ap" (apple and apricot)? Or top 10 fruits containing "ap" anywhere in their name (for example, papaya and pineapple)? Or something else?

    Hi Dop,

    You got this point right "top 10 fruits containing "ap" anywhere in their name (for example, papaya and pineapple)" will be listed one below another in list. if list matched is longer than 10 items due to "ap" user can scroll it up and down to see the item in list.

    Thanks.

  • Change condition in event #5 in my example to this:

    find(FruitsArray.CurValue, TextBox.text)>=0

    I don't know how to change the list size to 10 items, maybe you can do this with CSS.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Change condition in event #5 in my example to this:

    find(FruitsArray.CurValue, TextBox.text)>=0

    I don't know how to change the list size to 10 items, maybe you can do this with CSS.

    Hi Dop,

    I must say u r magician. it worked so butter smooth. Thank you so much. Now I am trying to find some method to display the list. Let me see if I can figure out this else will request you again for support and I am sure some solution we will arrive.

    Regards,

    jatin

  • Change condition in event #5 in my example to this:

    find(FruitsArray.CurValue, TextBox.text)>=0

    I don't know how to change the list size to 10 items, maybe you can do this with CSS.

    After replying to your comment, I got the reply so easily that I am very eager to share it. What I did is just 2 steps. I turned drop down list to list only and expanded it in UI now it showing results like google search box. Thanks again for your support.

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