Stupid popupmenu question

Hi folks. I’m using 2019r1.
I have 2 popup menus: 1 for country, and 1 for province or state.
When “Canada” is selected as the country, the country popupmenu deletes all province/state popupmenu rows and then loads all province names.
Same thing happens when I select “United States”, but it loads all state names.
Problem: I have a bunch of blank rows before the state names begin (provinces work as expected). They seem to take about the same space as the provinces would take up. I am using “if…else” in the country popupmenu to delete/load according to country selection.
Why am I getting all these blank rows?

sharing the usedcode will help to guess what was wong (if…)

1 Like

How are you removing the rows?

here’s the code in the change event for the country popupmenu (shortened version):

if me.ListIndex = 0 then
  provstate.addrow("British Columbia")
  provstate.addrow("Nova Scotia")
  provstate.ListIndex = 0
elseif me.ListIndex = 1 then
end if

NOTE: if I comment out most of the states, I get no blank rows.

EDIT: Argh. I should be using:

If me.selectedRow(1) then
// code here
end if


ListIndex 0 = Canada
ListIndex 1 = USA

You may try:

Me.AddAllRows("Saskatchewan", "Alberta") // etc.

Will that work in 2019r1?

The LR is your best friend:

Thanks for that, but that’s new in 2019r2

Sorry !

What really bothered me was the use of an Index instead of the Country name (.ListIndex = 0) instead of the Text of the selected Cell.

I searched ListBox in docs, then change the search to PopupMenu and fall into .AddAllRows…

Try to Add only one Row in the If Block and watch what happens.

Why not using a Select Case "Selected_Cell”

Case “Canada”

Case “USA”



Thanks, Emile! I had originally been using the text, but that produced the problem. I’ll try using case. Seems like a sensible solution. Will post back with results.

Case is giving me the same result. Blank rows when I change to USA. ??
Again, if I don’t load all 50 states, there are no blank rows.

Sure wish I could afford to update Xojo! Very little in the way of usable docs is a real pain.

Can you reproduce this in sample project? It’s a very curious effect you’re describing and I’d be interested to see it happen for myself.

Will do. BRB.

Thank you for asking that ! It was what I wanted to do to :wink:

Hmmm. Looks like it’s a linux problem. When built for windows 32-bit, there are no blank rows.
windows 32-bit (zip)
Xojo project file

EDIT: sorry if you’re getting a security warning on the download(s). I only have my home server for this kind of thing. I assure you the files are fine.

I’ve have the same issue on Linux. Popup menus often show blank rows at the top. Glad to know its not just me. I build for Linux but no actual Linux users so I haven’t taken the time to chase this.

Do combo boxes have the same issue?

Hm, I can’t even get the project to launch debug on my Mac.

Debugs to Windows just fine, and no blank rows, just as you mentioned Windows working correctly.

Unfortunately, if it’s a Linux bug you’ll have to file a ticket to get it fixed. To add salt to the wounds, if something needs to be fixed, it would likely only get fixed for the latest version.

I wish you the best of luck, but I don’t think I have anything to offer that can help. My only idea (read: shot in the dark) would be to use a Timer to relay loading the new rows until an event loop after you call DeleteAllRows.

Thanks, Tim & Emile for your input. Tim, I’ll try your suggestion after I see if a combo box behaves any better.

Well, a combobox only has 1 blank row at the top and 1 at the bottom. If I decide I can’t live with that, then I’ll have to try a timer & a loop. For now, at least, I’ll accept it as it is.