Need help with click error on a list box

  1. 3 months ago

    I'm not sure how to describe the problem I'm having but here goes
    I have a listbox with any number of items in it.
    I click on an item and most of the time in works OK, BUT every so often maybe 1 in 10 tries I click on an item in the program and it crashes.

    I Really need to find out what is happening because this same problem is happening in all my programs that have a listbox in them. It evens happen on other computes. So this is really a big problem for me.

    I have tried to find out what is happing by using the following code in the listbox change code
    TRY
    change code
    CATCH
    message "BAD MOUSE CLICK TRY AGAIN"
    END

    I also tried the same code in the mouse down code
    In either case when the program crashes I do NOT get the message. (It's like the program crashes before it can get to the code)
    What am I doing wrong!!! I need to find out what is happening and find a work around.

    Any help will be apricated
    Dave

    PS I'm running windows 10 if that helps. I think it happens when I click between items in the list but can't prove it one way or the other.

    Sorry I had to take some time off and look at all the information everyone had given me

    And I want to give a very big THANK YOU to Dale Arends. Your #6 (start from scratch with a 1 window project) got to me.
    So I did a one window program with just one listbox. I didn't have a failure.
    so it started me thinking and I started turning off and on other windows but anything below the first window would fail.
    In looking at the documentation I kept running across the word "COMBO" which seem to be preferred option.

    So I used a combobox instead of a listbox and to my amazement I haven't I haven't click failure yet. Of course I've only been trying for a couple of hours. LOL

    But I really want to thank Dale again because he gave me a starting point I could work with, and while I didn't solve the problem; I believe I have found a work around that I can live with.

    Thanks to everyone who tried to help me (I know I'm NOT the easiest person to work with)
    sometimes I just need to get away and start with the basics to solve a problem
    Dave

  2. Tim P

    Jul 3 Pre-Release Testers Rochester, NY

    Is it an exception or a crash?

    If it crashed, what does the crash log say?
    If it's an exception, what kind of exception? What line of code does it stop on?

  3. I don't know what it is.
    The program just closes and drops me back to the IDE? (back to where I write/edit the program).
    It's just like I loaded the program just before I hit the run button. There is no other indication that I can see.

    Sorry I'm not up on the termination and don't know what else to look at.
    Dave

  4. Tim P

    Jul 3 Pre-Release Testers Rochester, NY

    That sounds like a crash, so it's not something easy like an OutOfBoundsException. The crash logs might help give you an idea where to start looking.

  5. Jean-Yves P

    Jul 3 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    do you use the built-in method "quit" in your program ?
    if yes , search for all of them and add a breakpoint on each line
    see if it stops there after the crash.

  6. I have only 1 quit in my program. When the error occurs my code sheet stops at the quit command where I have the breakpoint
    does this help I've never done anything with breakspoint so I don't what to do next.

    I always use the command message "Here at quit" just before my quit command.
    I hope this is helping
    Dave

  7. Jeff T

    Jul 3 Pre-Release Testers Midlands of England, Europe

    Do you have an unhandled exception event handler on the app?
    Stick some logging code and/or a breakpoint there.

    do you have 'break on exceptions' turned on while debugging?

    Do you check that the row is a number less than the listcount in the change event?

    Its probably just an out of bounds exception that isnt handled.

  8. Jean-Yves P

    Jul 3 Pre-Release Testers, Xojo Pro Europe (France, Besançon)
    Edited 3 months ago

    @David H I have only 1 quit in my program. When the error occurs my code sheet stops at the quit command where I have the breakpoint
    does this help I've never done anything with breakspoint so I don't what to do next.

    I always use the command message "Here at quit" just before my quit command.
    I hope this is helping
    Dave

    some help here : https://docs.xojo.com/UserGuide:Debugger_Usage
    -image-

    in the bottom left of the pane, you have the stack. there you can see where the program comes from, and if you clic on each of the lines in the stack you see exactly where the program was lead to the quit command.

    Edit (Paul): Switched in URL to docs.xojo.com

  9. I'm sorry guys when the program crashes or stops it does not stop at the breakpoint.
    also list box has 3 cells in each line in the list box. Could that be the problem?

    Dave

  10. Jean-Yves P

    Jul 3 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    @David H also list box has 3 cells in each line in the list box. Could that be the problem?

    make it a 2 cells or 4 cells for test purpose. and see if it continues crashing or not.

  11. I went from 2 cells to 3 cells and it still fails.
    Dave

  12. Do you use an anti-virus anti-malware program? I had very similar problems (not with a listboxes) where the debug app would simply close unceremoniously. Once I registered the debug app as safe with BitDefender, I never had the problem again.

  13. Interesting that maybe the problem. I have Norton but don't know what the debug app would be and I as far as I know I don't have Bitdefender either.

    Dave

  14. I used to use Norton. I am pretty sure it has the same feature - it monitors active apps for suspicious activity, whatever that is. Use the Norton configuration settings to disable the malware detection and then run the Xojo app again. At least that will tell you if Norton is the problem.

  15. I unhooked the internet and turned off all the anti-virus and firewalls and exploit prevention off. Still have the problem.

    But did I need to turn off any windows security too?
    Dave

  16. Emile S

    Jul 4 Europe (France, Strasbourg)

    Listbox (Row, Column, ListCount, etc.), Arrays, etc. returns or use 0-based values.

    Overall, without seeing real code how can we guess the correct anwser ?

  17. Are you working in a built module or in the IDE? If in the IDE, set a breakpoint before it crashes, and then step through line by line until it crashes, and then you know the offending line.

    Are you using a thread, timer, or other background process that could be running at the same time and that could be crashing the program? If so, deactivate them and see if the crash still occurs.

    Are you using a lot of memory (images or videos)? A Xojo app will crash without warning if you run out of total system memory.

  18. Edited 3 months ago

    I'm using the IDE and have 12 Gigs of memory.
    I've used the TRY command as the first line in the CHANGE function of the Listbox and on the mouse down & up and it never gets there. (see my original question)
    The problem with using a breakpoint is that the failure only happens once in a while maybe 1 in 25 tries.

    as far as "Overall, without seeing real code how can we guess the correct answer ?" is concerned I'm not sure what you mean by real code.

    It's like it fails when I click on an item in a listbox and never gets to any code thereafter (Not exception, or TRY or even a Message statement. ) Is there anywhere else I can put the TRY command or Message command? or is there an ON ERROR command?

    Like I said before any ideas will be greatly apricated as I'm not the brightest bulb around.
    Thanks
    Dave

    PS As far as I know I'm NOT using a thread, timer, or other background process that could be running at the same time.

  19. Edited 3 months ago

    It is worth knowing if the program is even reaching the code in your ListBox event handler.

    Consider putting something like this at the beginning of your MouseDown (or other event handler you are using) code:

    STATIC RunCount AS INTEGER = 0
    RunCount = RunCount + 1
    DIM d AS NEW Date
    DIM Now as STRING = d.LongTime
    
    DIM f AS FolderItem = GetFolderItem ("SomeFileName.log")
    IF f <> Nil THEN
      DIM t AS TextOutputStream = TextOutputStream.Append (f)
      t.Write Now + " (" + Str (RunCount) + ")" + EndOfLine
      t.Close
    END IF

    Choose an appropriate path and file name for SomeFileName.log.

    Monitor the log file. Especially keep track of the number of times you click, and check if the log file agrees with the number of Event responses. If the code does not even run on the cycle that the app crashes, then you probably have a compiler bug. If the event response runs before the crash, then move the above code down, after a few lines of "real" code in your event handler, until you find the offending line of code.

  20. Dale A

    Jul 5 San Diego, California, USA

    Without seeing the actual code, we're all guessing here so let's clear up a few specifics to help us (me) focus.

    1. You said you're on Windows 10. What version Xojo are you using?
    2. Since you said it happens in all your programs that have a listbox in them and on other computers, I assume that you built the App and moved the executables and Libs to the other machines. Perhaps the Xojo installation is somehow munged. Have you removed it and reinstalled from a freshly downloaded copy? Remove any 3rd party plugins, scripts, etc., that you may have.

    If you have done the above without success ...

    1. You say "when I click on an item..." what are you clicking on? Are you clicking on the listbox header, a cell in a row, in the space below the last row?
    2. If you are clicking on a cell, does the app just select the row or are you opening the cell for editing? (Calling EditCell?)
    3. Does the crash happen when a cell is selected and you click on another cell in the listbox in the same row? Or in a different row/column? Or in the free space below the last row? Or someplace outside the listbox?

    Lastly,
    6. Try starting a new, blank project with nothing in it and, from the IDE's Control Library, add only a listbox to the main window. Add a few rows of data in the Listbox's Open event. Run it and go on a clicking spree. Does the problem still occur? If so, revisit item #2.

  21. Newer ›

or Sign Up to reply!