Listbox Addrow problem

  1. ‹ Older
  2. 7 weeks ago

    Dale A

    Jan 2 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.

  3. Dale A

    Jan 2 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.

  4. Tim P

    Jan 2 Pre-Release Testers feedback://46303

    @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.

  5. Julian S

    Jan 2 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

  6. Derk J

    Jan 2 Pre-Release Testers, Xojo Pro

    Htpp post?

  7. Joseph E

    Jan 2 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?

  8. Emile S

    Jan 2 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
  9. Julia T

    Jan 2 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?

  10. Dale A

    Jan 3 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.

  11. Dale A

    Jan 3 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.

  12. Julia T

    Jan 3 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.

  13. Tim P

    Jan 3 Pre-Release Testers feedback://46303
    Edited 7 weeks 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.

  14. Dale A

    Jan 3 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.

  15. Derk J

    Jan 3 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 ?

  16. Emile S

    Jan 3 Europe (France, Strasbourg)

    No nap for me this afternoon, but when reading the answers in this Conversation, something comes back to my mind: a bug of mine…

    Answer #1:
    In a Listbox, I change the number of Columns at Insert time, then add some row(s), and a following addition (Paste) I noticed a miss in the number of columns. I added some columns and my data went back.

    Answer #2:
    If in your data (the data you want to Paste) you have an EndOfLine (Return, LF, Enter, whatever), you will not be able to watch anything but an empty line.
    To check that, set your Listbox to all columns Editable(s) by a simple click (or a DoubleClick), and try to edit one of the “empty Cells”, place the cursor at the end of the Cell contents, then press the Delete key and watch carefully what happens…

    Of coure, Tim is right: it is not easy to make diagnostics without seeing the project.

    Back to the number of columns: when you change the number of columns of a Listbox, you do not delete the contents of the Listbox, you only display that amount of columns; if you change the number of colums back to the original number, you get your previous data back on display. (provided you do not delete the previous Rows / close the window, etc.

  17. Dale A

    Jan 3 San Diego, California, USA

    I was able to create a test app that shows the problem and created a FB report.

    Feedback Case #54571

  18. Dale A

    Jan 3 San Diego, California, USA

    @Emile S No nap for me this afternoon, but when reading the answers in this Conversation, something comes back to my mind: a bug of mine…

    Answer #1:
    In a Listbox, I change the number of Columns at Insert time, then add some row(s), and a following addition (Paste) I noticed a miss in the number of columns. I added some columns and my data went back.

    Answer #2:
    If in your data (the data you want to Paste) you have an EndOfLine (Return, LF, Enter, whatever), you will not be able to watch anything but an empty line.
    To check that, set your Listbox to all columns Editable(s) by a simple click (or a DoubleClick), and try to edit one of the “empty Cells”, place the cursor at the end of the Cell contents, then press the Delete key and watch carefully what happens…

    Of coure, Tim is right: it is not easy to make diagnostics without seeing the project.

    Back to the number of columns: when you change the number of columns of a Listbox, you do not delete the contents of the Listbox, you only display that amount of columns; if you change the number of colums back to the original number, you get your previous data back on display. (provided you do not delete the previous Rows / close the window, etc.

    Both of these scenarios are interesting but I am not doing anything to the column counts and none of the data is multiline.

    @Derk J 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 ?

    No, I haven't but since the data is correct and intact in the array just before the addRow, I don't see how they apply. (I may be wrong, of course.)

  19. Tim P

    Jan 3 Pre-Release Testers feedback://46303

    @Dale A No, I haven't but since the data is correct and intact in the array just before the addRow, I don't see how they apply. (I may be wrong, of course.)

    We ruled out a bizarre Xojo.Net.HTTPSocket bug when your literal AddRow test failed.
    (but yes, it can happen, the newer sockets are super unstable)

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

    @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.

  20. Emile S

    Jan 3 Europe (France, Strasbourg)

    Sorry Dale, it seems that I skipped some lines in the original question.

    Did you try with the new (replacing) Xojo 2018r4 instruction (forgot the name…) I found it:

    http://developer.xojo.com/URLConnection

    ?

    Unfortunately, I do not have my Lenovo (no kudos for them) Windows 10 laptop to test the project (it works on El Capitan).

  21. 6 weeks ago

    Julian S

    Jan 3 Pre-Release Testers, Xojo Pro UK

    This is why test apps are so important as its clearly a framework bug as you can force the window to paint correctly if you drag it off the screen and back on, I hadn't even considered testing that, glad you got it narrowed down Dale,

    This code works to get you out of PageReceived and away from Xojo.Net.HTTPSocket but its not really a good system as you could end up with data out of order as I believe calllater aren't fifo in xojo (but without a test I couldn't say for sure).

    https://www.dropbox.com/s/nl1jsp0wutjzlnz/ListboxAddrowIssue2.xojo_binary_project?dl=1

or Sign Up to reply!