SOLVED: ComboBox on Windows: two different lists?

I’m implementing a selection box for countries in my app.

the code is exceedingly simple:

I have a module Info with a property ListOfAllCountires() as String

The code in the ComboBox is very simple:

Sub Open() Handles Open
  me.AddRows Info.ListOfAllCountries
End Sub

and

Sub TextChanged() Handles TextChanged
// delete all rows in array 
Me.DeleteAllRows

If Me.Text = "" Then
  
  Me.AddRows Info.ListOfAllCountries
  
Else
  
  Dim selStart As Integer = Me.SelStart
  
  For Each country As String In ListOfAllCountries
    
    If InStr( country, Left(Me.Text, selStart ) ) > 0 Then 
      Me.AddRow country 
    End If
    
  Next
  
End If
End Sub

On the Mac it works as expected and typing Ger shows the following countries:

Algeria
Germany
Niger
Nigeria

However on Windows 10 it just shows the countries STARTING with Ger (with autocomplete enabled) or nothing (with autocomplete disabled - it also deletes the entered text).

Interestingly while with autocomplete enabled the automatic drop down shows everything starting with Ger, clicking on the show part of the ComboBox shows the correct four countries.

Any way to disable the automatic menu on Windows???

By “automatic menu” do you mean “autocomplete”?
Me.AutoComplete (or Me.AllowAutoComplete if you’re using r2+) = False

I can confirm this behaviour.

When AllowAutoComplete is False (default) then (at least on my Windows 10 VM), the control is broken. The text you type gets deleted as you type. This must be a bug.

If AllowAutoComplete is True then, as you say, it correctly displays countries starting with the letters you type but doesn’t detect matches within the countries, unlike macOS which does. The behaviour on Linux matches Windows 10.

Feedback bug report: feedback://showreport?report_id=59034.

Garry, if you type Ger and click on the down triangle then a menu with the correct four countries shows (eg Algeria, Germany, Niger, Nigeria).

I think basically the ComboBox shows both the system menu and on clicking shows the Xojo menu.

Is Xojo’s implementation even using the native ComboBox?

I’ll try to upload an animated gif tomorrow.

P.S. I suspect that SelStart is incorrect (a long standing Xojo bug on Windows). Can’t test until tomorrow.

Garry,

The feedback link doesn’t work for me. It doesn’t show any URL.

Not sure why that is. I’ve put the absolute URL in the text.

Well, the problem is not SelStart.

Typing in the ComboBox:
screenshot_1

Clicking on the down arrow of the ComboBox:
screenshot_2

Any idea on how to disable that first one or modify it???

Maybe I should do it the M&X way and call it a feature? :wink:

59038 - Combobox on Windows seems to have two different lists
feedback://showreport?report_id=59038

Btw if you type a character in the ComboBox with autocomplete OFF then

if me.text = "" then

is true and the character is deleted (so it is impossible to enter any text).

That ComboBox is a mess.

Yep - it’s not in a great state. I including the deleting of test in my feedback report.

Just found a workaround.

Set autocomplete to true in the IDE.

In the ComboBox Open event: me.AutoComplete = False

The system list is no longer shown.

1 Like

Ummm… did you “find” it in my reply to you (the first reply to your OP)? :wink:

Looks like quoting is broken on the forum?

Test:

Ok, extended quotes are broken?

Test:

[quote=“MarkusWinter, post:12, topic:77, full:true”]
Just found a workaround.[/quote]

Yup.

would think that needs to be reported to the powers that be IF it were an issue
but I just quoted your whole post so …

IF there is any issue it looks like the [/quote] has to be on its own line

This seems really wrong to have to do this using this form
Make sure you add that to the bug report as that just seems SOOOO wrong

Two ways to quote:

  1. Prefix each line with > (see here).
  2. Highlight the text you want to quote by selecting it (just like you would if you were going to copy it) and a little button should appear next to your mouse cursor saying “Quote”. Click that and it’ll wrap the text in a quote citing the author.

Another test…

@npalardy FTW

Nope.

Your answer was missing the important info that you need to set autocomplete to true in the IDE AND turn it off in the open event (as counter-intuitive as that may be).

But playing around I came to the same conclusion (by which time I had forgotten about what you wrote).

But thanks for the correct answer.

You can just set the property in the IDE, you don’t have to do it in the Open Event, do you?