Advice on which control to use please

Hello All

I’m developing a membership database app for an organisation I support. The membership is internatonal, with some 22 countries represented.

I want to be able to restrict country choice on a form to only the countries where the organisation operates. In DB terms, this is easy - integer ID foreign key from member table into country table, where you pick up the name, and whatever other fields the app needs.

What control should I use to list the country name (rather than the ID) so that when the user selects from a dropdown (or similar) I can get the ID back to process?

In MS Access I’d do a two-column dropdown with the first column width set to zero, and just set the value of the control to the retrieved ID when the data is retrieved - but I can’t see anything obviously equivalent in Xojo.

The users need to be limited to only pick a country off the available list.

Advice welcome!

Thanks and best regards
Steve J

Use a Popup menu and set the RowTag for each row you add. When someone selects from the list you can get the country code using:

CountryKey = PopupMenu1.RowTagAt( PopupMenu1.SelectedRowIndex )

The RowTag can be any datatype you want. so “UK, United Kingdom” or “1, United Kingdom” with your integer ID that would be fine for the RowTag.

1 Like


This will allow you to add both a row and tag at the same time:

Public Sub AddRowAndTag(extends pm as PopupMenu, sCaption as String, vTag as Variant = nil)
  pm.RowTagAt(pm.LastAddedRowIndex) = vTag
End Sub

Edit: Woulda been first if I hadn’t spent time writing example code :stuck_out_tongue:


Look at RowTagAt

So known fact… :sweat_smile: