Beta Test - AutoCompleteEditText

stevel05

Expert
Licensed User
Longtime User
I've just tested AutoCompleteEditText on a fairly large sample, over 1200 items, and all works smoothly - even on the emulator. my one observation is that changes to the text attributes for the edit box are not mirrored in the drop down and I couldn't find a option to change then separately.

I appreciate that this is a separate view, but it would be useful to be able to change the attributes for the list as well as the edit text, probably separately.

For example, I have an app that replaces the standard font with a custom font that better represents musical symbols. The AutoComplete would be perfect to use for Chord selection, but would need to display the selection Items using the custom font.

I think it would also be useful to be able to change the size of the font, the background colour and the font colour.

Steve
 

juncus

Member
Licensed User
Longtime User
I've just tested AutoCompleteEditText on a fairly large sample, over 1200 items, and all works smoothly

Hi Steve I don't suppose you could post an example? I can't find any documentation on AutoComplete. I would like to be able to load a list of items but without any documentation it is a little difficult to see how it's done.

I've searched the forum and the help viewer and have found nothing. It doesn't even get a mention in the Library.

Thanks
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Here's a simple example using numbers (easier to set up) as I didn't have any text lists to hand.
 

Attachments

  • acet.zip
    6.2 KB · Views: 481
Upvote 0

juncus

Member
Licensed User
Longtime User
Thanks Steve most helpful and all I should need.
 
Upvote 0

Asmoro

Active Member
Licensed User
Longtime User
AutoCompleteEdittext with a ScrollView issue

@stevel05:

Thanks for your example for AutoCompleteEdittext.
I use this for my own project.

Instead using a text file, I use this to get image files on a scrollview.

But I got stuck how to code for implementing the right way.

I hope you can help me out by using the attached testexample underneath.

Thanks for now.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Hi,

You already had the file list, so you just needed to add that to acet in the activity create of the scrollview module. You also need to code the jump to the correct image in acet_TextChanged.

Hope this helps
 
Upvote 0

Asmoro

Active Member
Licensed User
Longtime User
Hi,

Thanks helping me out, but what is the right code for jumping to the image
in acet_TextChanged?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Something like this:

B4X:
Sub acet_TextChanged (Old As String, New As String)
   'Code here to jump to selected item
   If New <> "" Then   
      Dim TestStr As String
      Found=-1
      For i = 0 To Main.Files.Size-1
         TestStr=Main.Files.Get(i)
         If New.ToLowerCase = TestStr.substring2(0,New.Length).ToLowerCase Then 
            Found=i
            Exit
         End If
      Next
      If Found <> -1 Then ScrollView1.ScrollPosition= 5 + (Found * 300)
   Else
      ScrollView1.ScrollPosition=0
   End If
End Sub

You'll need to decide how to show that the last item in the list is selected, either by adding space so that it can appear at the top of the visible list, or some other way.
 
Upvote 0

Asmoro

Active Member
Licensed User
Longtime User
Hi,

I was testing your code, but I bumped to an error (see attached image)
So it didn't executed well.
Than I tried to make a 'SortCaseInsensitive', but IDE didn't let me doing this.
Now what..?

You'll need to decide how to show that the last item in the list is selected, either by adding space so that it can appear at the top of the visible list, or some other way.

Yeah, I eventually have to figure this out as well.

Btw, I've made a search button in the testprog as a part of a testcase.
Using EnterPressed, how do you plan to code this in combination with searchbox?
 

Attachments

  • ErrorImage.jpg
    54.5 KB · Views: 251
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes, you'll need to check string lengths, file extensions (if you want them) etc.

I would think the search routine would be separate from the AutoCreateEditText.
 
Upvote 0

Asmoro

Active Member
Licensed User
Longtime User
Thanks for all your help, I'm learning more and more each day.

note. pity that it's not executed nicely from the start.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…