Listbox Addrow problem

  1. 11 months ago

    Dale A

    31 Dec 2018 San Diego, California, USA

    I'm seeing a strange problem with ListBox.AddRow (on Windows 10, Xojo 2014r4) and I'd like to know if anyone else is seeing it or has a solution.

    My app retrieves some data from a web API and uses the data to build an 8 element string array. It then does a ListBox1.AddRow(theArray) to populate the data into an 8-column listbox. Instead of the entire row coming visible, only the first three columns show data. The data is there in the other cells and will get displayed if I click on a header or select the row. If the data returned from the API has multiple sets of data, each set will populate the array in turn and be added to the listbox. In this case, all of the rows are completely displayed except for the last row which, again, only displays the first three columns.

    I have tried putting a ListBox1.Invalidate after the row(s) have been added but that does not seem to help. Other than putting the data into the listbox, I am doing no Cell text processing. I've tried Adding a blank row and populating the cells individually but that doesn't seem to help either. I've cleared the caches, uninstalled and reinstalled 2018r4 but the problem remains.

    I've tried to create a test program to show the problem but each time I do the issue doesn't manifest.

    The project works fine if built under 2018r3. I'm at the end of the few wits I have left.

  2. Tim P

    31 Dec 2018 Pre-Release Testers Rochester, NY

    How is the data being fetched?

  3. Julia T

    31 Dec 2018 Sandy Hook, Connecticut

    Assuming you meant 2018r4 and not 2014r4" as posted, the fact that it works fine under 2018r3 would seem to indicate a Xojo bug introduced in the last release. Of course, if you can't submit a sample project any feedback report will be closed as "not reproducible" :(

  4. Julian S

    31 Dec 2018 Pre-Release Testers, Xojo Pro UK

    Do you have any code inside the CellBackgroundPaint, CellTextPaint or DisclosureWidgetPaint events?
    Is the ListBox sitting inside any other controls, or is it directly on the window?
    What scale factor is your desktop?

  5. Dale A

    1 Jan 2019 San Diego, California, USA

    @Tim P How is the data being fetched?

    The data is being fetched through a Xojo.Net.HTTPSocket and processed into the array in the PageReceived event handler before being sent to the listbox. Examination of the populated array immediately before the AddRow call shows that the data is there and correct, so I don't see how that could be the problem.

    @Julian S Do you have any code inside the CellBackgroundPaint, CellTextPaint or DisclosureWidgetPaint events?
    Is the ListBox sitting inside any other controls, or is it directly on the window?
    What scale factor is your desktop?

    There is no code in any of the cell-specific events. That was the first thing I removed in my debugging attempts. The listbox is directly on the window. The only other controls on the window are a pushbutton, a couple of labels, and a textfield, none of which encroach on the listbox. The scalefactor of the window is 1 (I don't think I've ever used this particular item).

    @Julia T Assuming you meant 2018r4 and not 2014r4" as posted, the fact that it works fine under 2018r3 would seem to indicate a Xojo bug introduced in the last release. Of course, if you can't submit a sample project any feedback report will be closed as "not reproducible" :(

    Oops! Yeah, that was a typo. I'm using 2018r4 when I see the problem, not 2014r4.

  6. Julian S

    1 Jan 2019 Pre-Release Testers, Xojo Pro UK

    If you change the addrow to insert static data does it still break? i.e.

    s = Array ("1", "2", "3", "4", "5", "6", "7", "8")
    listbox1.AddRow(s)
  7. Dale A

    2 Jan 2019 San Diego, California, USA

    @Julian S s = Array ("1", "2", "3", "4", "5", "6", "7", "8")
    listbox1.AddRow(s)

    Yes. Only the 1, 2, and 3 show up.

  8. Dale A

    2 Jan 2019 San Diego, California, USA

    Just for fun, I added a second listbox and added an AddRow call pointing to the second listbox immediately before the call to the original llistbox. This new listbox has no code in any event handler and, except for the column count, is totally vanilla.

    Both listboxes show only the first three columns.

    I need to do more detective work, I guess.

  9. Tim P

    2 Jan 2019 Pre-Release Testers Rochester, NY

    @Dale A Yes. Only the 1, 2, and 3 show up.

    Oh good, this means it's not a sneaky Xojo.Net.HTTPSocket bug. There were some weird behaviors on Windows at one point, which is why I was curious if the socket could possibly be the issue.

  10. Julian S

    2 Jan 2019 Pre-Release Testers, Xojo Pro UK

    @Tim P Oh good, this means it's not a sneaky Xojo.Net.HTTPSocket bug. There were some weird behaviors on Windows at one point, which is why I was curious if the socket could possibly be the issue.

    I like to narrow things like that down as quickly as I can ;)

    PM sent to you Dale

  11. Derk J

    2 Jan 2019 Pre-Release Testers, Xojo Pro

    Htpp post?

  12. Joseph E

    2 Jan 2019 Pre-Release Testers CA

    @Dale A Yes. Only the 1, 2, and 3 show up.

    Very odd. This works for me in 2018R4:

    Dim num() As String = Array("1","2","3","4","5","6","7","8")
    ListBox1.AddRow(num)

    so does this:

    listbox1.AddRow("1","2","3","4","5","6","7","8")

    Maybe just loop through your array with a msgbox, examining the contents?

  13. Emile S

    2 Jan 2019 Europe (France, Strasbourg)

    @Joseph E Maybe just loop through your array with a msgbox, examining the contents?

    No, use the debugger to scan (read) what the array contents is.

    Back to :

    Dim num() As String = Array("1","2","3","4","5","6","7","8")
    ListBox1.AddRow(num)

    What happens if you use:

      Dim num() As String = Array("1","2","3","4","5","6","7","8")
      LB.AddRow(num)
      
      LB.ColumnCount = UBound(num)+1
  14. Julia T

    2 Jan 2019 Sandy Hook, Connecticut

    Random thoughts:

    The fact that your own test programs do not exhibit the problem may be a useful clue - look for differences between that case and your app that has the bug.

    I assume that the problem only manifests when using AddRow and not if you write to the cells individually, right?

    You said you tried listbox.invalidate - have you tried listbox.refresh?

  15. Dale A

    3 Jan 2019 San Diego, California, USA

    @Emile S No, use the debugger to scan (read) what the array contents is.

    Back to :

    Dim num() As String = Array("1","2","3","4","5","6","7","8")
    ListBox1.AddRow(num)

    What happens if you use:
    Dim num() As String = Array("1","2","3","4","5","6","7","8") LB.AddRow(num) LB.ColumnCount = UBound(num)+1

    Checking the array in the debugger before and after the AddRow shows in both cases that the array contains the correct data. BTW, it's a String array so there's no on-the-fly conversions.

    @Julia T Random thoughts:

    The fact that your own test programs do not exhibit the problem may be a useful clue - look for differences between that case and your app that has the bug.

    I assume that the problem only manifests when using AddRow and not if you write to the cells individually, right?

    You said you tried listbox.invalidate - have you tried listbox.refresh?

    Yes, I tried Listbox1.Refresh also and had the same results. As for writing to the cells individually, that caused only the first TWO cell to be displayed.

    What is really confusing me about this is the fact that if I click on the listbox's Header, the cells in the listbox show all of the data in the cells. This tells me that the cells actually have the data in them but for some reason aren't displaying it.

  16. Dale A

    3 Jan 2019 San Diego, California, USA

    My last statement in my post had me thinking. If it is just a display problem, maybe I should simply set the ListBox's Selected row to LastIndex and then remove the value. So I put in the code immediately after the AddRow

    Listbox1.Selected(Listbox1.LastIndex) = True
    Listbox1.Selected(Listbox1.LastIndex) = False

    and that seems to work. It's about as ugly a solution workaround as there is but at least it works.

    My thanks to everyone who gave suggestions and brain cells on this.

  17. Julia T

    3 Jan 2019 Sandy Hook, Connecticut

    What's bugging me is that I have a vague recollection of encountering this myself at some time in the past, but my fading memory can't retrieve it, sorry :( I'll keep trying.

  18. Tim P

    3 Jan 2019 Pre-Release Testers Rochester, NY
    Edited 11 months ago

    Can you provide the project to someone to look at? Unfortunately, if the issue doesn't present itself in a demo project, there is nothing we can do here without seeing the project.

    Don't feel bad about your workaround either, a similar style workaround is required to get the header to update if you're setting the listbox to unsorted and want the sort direction indicator to clear.

  19. Dale A

    3 Jan 2019 San Diego, California, USA

    @Tim P Can you provide the project to someone to look at? Unfortunately, if the issue doesn't present itself in a demo project, there is nothing we can do here without seeing the project.

    Don't feel bad about your workaround either, a similar style workaround is required to get the header to update if you're setting the listbox to unsorted and want the sort direction indicator to clear.

    Thanks, Tim, but I don't have permission from the originator of the code to give it to anyone. Once the project is done, I plan to try to reproduce the issue in a demo project but so far haven't been able to.

  20. Derk J

    3 Jan 2019 Pre-Release Testers, Xojo Pro

    Do you even define the encoding of the string that you get from the response? And do you have AllowLossy true or false in the conversion from xojo.net.httpsocket ?

  21. Newer ›

or Sign Up to reply!