Oddity with Modern Preferences and combo box

I’d appreciate some insight into a problem I’ve run into with the ModernPreferences tool. I’ve been using this for a while with no problems and it works well in loading and saving string properties with preferences files. But today I’ve been puzzling over its behaviour with combo boxes. I wanted to store recent servers in a prefs file and then load them into a combo box. The current server goes into the text box and a list of recent server URLs goes into the combo box list.

The oddity is that I can assign a prefs entry to the text box fine, using

ComboBox1.Text = Preferences.ServerURL

but when I try to add a row to the combo popup menu with one of the other prefs entries it fails to run with the “There is more than one method with this name” error.

The prefs file contents look like this:


And as I say, the program seems happy to load a value into the combo box text box but not into the combo box list. I suppose I’m wondering whether ModernPreferences returns a string when it is loaded, and if not maybe that’s what’s going wrong. The various methods in ModernPreferences have a return type of “Auto” which doesn’t illuminate matters.

I have created a very simple project that illustrates this and am happy to share it (if I can work out how to), but I don’t want to clutter up this posting unduly with my code in case there is something obvious that I am missing.

Thanks in advance for any guidance that you can offer.

I’ve solved my problem. I think it’s a bit of a hack but it works. I saw an earlier thread (Auto to Text) where it seems possible to force an auto variable into a Text variable. My mangled hack of that more elegant code looks like this:

Function autoToText(a as Auto) As Text
Dim info As Xojo.Introspection.TypeInfo = Xojo.Introspection.GetType(a)

select case info.Name
case "Text"
  return CType(a, Text)
end select
End Function

I wish that the original ModernPreferences didn’t have to use Auto.