Listbox Deselect

  1. 2 weeks ago

    Bob G

    May 12 Pre-Release Testers, Xojo Pro Minneapolis

    I you have a listbox with some rows, users may click on a row; and the row is selected. If users click on the white space below the rows, nothing is selected. One can detect this and do whatever is necessary.

    The problem in Windows is that the previously selected row retains a gray outline. My tester felt this would be confusing.

    Searching the Forum I found a suggestion to simply reload the listbox. This seemed a bit like overkill.

    Here's something I tried that appears to work: i appended a blank row, selected it, and then removed it. This is in the Change event if me.listindex = -1

    me.addRow("")
    row = me.lastindex
    me.selected(row) = true
    me.removeRow(row)

    Hope this helps.

    -Bob

  2. Kem T

    May 12 Pre-Release Testers, Xojo Pro, XDC Speakers New York

    lb.Invalidate doesn't do it?

  3. Julian S

    May 12 Pre-Release Testers, Xojo Pro UK
    Edited 2 weeks ago

    The grey dotted outline is actually standard windows behaviour IF a key has been pressed while focus is in that window, its part of the keyboard assisted navigation system, it shows you where your keyboard navigation will move from when you return to the control. Try it on the printer select window of notepad, if you pick a printer, press tab (to activate the dots) then click the white space next to the printers the grey dotted outline shows up on your old selection. The bug (Feedback Case #52586) in Xojo is that its showing all the time even if a key isn't pressed which isn't standard windows behaviour. I agree, it looks bad being there from the start however I wouldn't program around it as people who use keyboard or accessibility controls to navigate your window will have issues with the loss of focus.

  4. Dale A

    May 13 San Diego, California, USA

    Turn off UseFocusRing for that listbox either in the Inspector or in code.

or Sign Up to reply!