Perhaps you can remove these empty rows after they are added?
E.g.:
for i as integer=me.RowCount-1 downto 0
if me.row(i)=“” then me.RemoveRow i
next
(I tried to remember API1 syntax, so you may have to adjust).
Since I’ve not experienced the issue you’re seeing, I don’t know what the rows actually contain. I’m assuming they’re an empty string, but you may first check yourself (inspect the content of an empty row in the debugger) and then replace the “” value in the code above to the one you find.
HTH.
Besides Tim’s suggestion of using a timer!
Supposing provstate has got a change event, I’d try adding to the window a ‘isLoading’ property, then:
isLoading = true
if me.ListIndex = 0 then
provstate.DeleteAllRows
etc.
elseif me.ListIndex = 1 then
provstate.DeleteAllRows
etc.
end if
isLoading = false
Then in the change event of provstate:
if isLoading then return
Thank you, Jeff. I changed my code to use case awhile ago, and it made no difference. As per suggestions earlier in the thread, could this be a linux/old Xojo version issue?..and why would the list of states appear correctly if it’s a shortened list rather than all 50?
There are exactly 50 addrow statements to populate the list. I tried your deleteallrows alternative, and that produces the same blank rows. I’ll try your suggestion for using a method after I get a wee bit of shut-eye. It’s been a very long night. Thank you again.
This can take a long time, but in the Documentation web site,you can read the Release Notes since 2013 (and even earlier): search there if this bug was removed …
If you find nothing in the Release Notes (I tried to Google, but…)…
Can you download Xojo current version (1) and check with it if the bug still here ?
Hi Arnaud. RowCount doesn’t exist in 2019r1, and the only thing I could think to use was Count. I keep getting the error saying that “row” doesn’t exist. Sorry if I’m missing something obvious, new business startup happening and my brain is full. LOL
Hi Emile. I may try that, I’m just loathe to undo what the newer version does when it takes over my associations. Besides, if the new version does have the bug fixed, it doesn’t help me since I don’t have $$$ to upgrade.
Also… did you try to use the States codes instead of the States Full Names ?
(MN for Minnesota)
It may be a matter of used RAM or cummulative length of string or…
To me, we need to find out where the extra lines are coming from.
The first step would be to issue the DeleteAllRows command, and then DO NOTHING ELSE.
If you do that, do you still have blank rows?
If so, add a message box to display the row count
msgbox cstr(provstate.listcount)
… eg you may be able to see blank rows, but are they really there, or is it just failing to refresh?
IF there are blank rows after the deleteallrows, then it’s a Xojo bug.
We can come back to that.
IF THERE ARE NO BLANK ROWS after the DeleteAllRows, then the next question is ‘where do the blank rows come from?’
My idea is to find all places where you currently have provstate.addrow
and use a method instead
The method still ‘just’ does an addrow.
Public Sub AddrowReplacement(s as string)
provstate.addrow s
end sub
But you can quickly add code in that to check ‘how it is going’
Public Sub AddrowReplacement(s as string)
dim rowsSoFar as integer = provstate.listcount
provstate.addrow s
if provstate.listcount <> rowsSoFar +1 then
msgbox "Added one row but an extra one has appeared!"
end if
end sub
Thank you so much for taking the time help, Jeff. I made the changes you mentioned above, and still have the same result, but there were no msgboxes popping up. Then I wondered if the single blank “row” at the top & bottom of the list is just a placeholder for the list scrollers…especially since clicking on either one of them doesn’t select anything in the list or result in any odd behaviour.
If this is the case, you are all well within your rights to nuke my house.
But this doesn’t explain why a popup menu adds a whole pile of blank rows (which is why I switched to a combobox). Incidentally, I’m not the only one to see this behaviour in popup menus when using Xojo for linux.
I dont think he has any now.
By the sounds of it (lots of guessing going on here as we can’t see the code) , the original problem was a popupmenu not a listbox.
Now it IS a listbox, there are not lots of empty rows.
Been trying to fix the wrong problem.
If it works with a listbox, that’ll do I guess