ListBox - making only checkboxes clickable

  1. 5 weeks ago

    Val K

    Jan 12 Pre-Release Testers, Xojo Pro

    Hi, guys,

    I have a ListBox with checkboxes. The ListBox is populated programmatically (via code).

    I want to make only the checkboxes of the list clickable (I do not want the user to be able to select a row in the list).

    Is this possible?

    Thank you,

    Val

  2. Emile S

    Jan 12 Europe (France, Strasbourg)

    10 minutes to not find how to set the Row in a API2 ListBox…

    Was Me.ListIndex = -1 in API1, but… was changed to be more intuitive.

    Can I get a more intuitive brain exchange, please ?

  3. Val K

    Jan 12 Pre-Release Testers, Xojo Pro

    Emile,

    I have no idea what you just said.

    Val

  4. Emile S

    Jan 12 Europe (France, Strasbourg)

    What Xojo version are-you using ?

  5. Val K

    Jan 12 Pre-Release Testers, Xojo Pro

    2019 r3 - Mac

  6. Emile S

    Jan 12 Europe (France, Strasbourg)

    Same here (for tests).

    The idea was to Reject the click in MouseDown in setting ListIndex to -1.

    I wanted to test before sharing, but I failed...

  7. Tim P

    Jan 12 Pre-Release Testers, Xojo Pro Rochester, NY
    Edited 5 weeks ago

    The selection indicator is just a drawing. You can override the drawing of the selected row with CellBackgroundPaint. I've done just this in my own apps. Fill a rect the size of the cell that is the color of the background of the control and return true. This will override the selection drawing.

    Alternatively, you could change the selection by to -1 whenever it changes. This approach may come with unexpected behavior.

    Emile, you can still use the classic API (Listbox.ListIndex) in 2019r3 it only does not show in auto complete.

  8. Tanner L

    is not verified Jan 12 Pre-Release Testers Canada

    @Emile S 10 minutes to not find how to set the Row in a API2 ListBox…

    Was Me.ListIndex = -1 in API1, but… was changed to be more intuitive.

    Can I get a more intuitive brain exchange, please ?

    Maybe SelectedRowIndex?

    Intuitive brains are deprecated.

  9. Emile S

    Jan 12 Europe (France, Strasbourg)

    and the ESP module is still not released… ;)

  10. Val K

    Jan 12 Pre-Release Testers, Xojo Pro

    Big thanks to everyone for the suggestions.

    It appears that implementing a possible solution is more of a trouble than a benefit for the application.

    Thank you again,

    Val

  11. Markus R

    Jan 12 Pre-Release Testers, Xojo Pro Europe / Germany

    in the Change Event this row will undone a selection

    If Listbox1.SelectedRowIndex  >-1 Then Listbox1.SelectedRowIndex  = Listbox1.NoSelection
  12. Karen A

    Jan 12 Pre-Release Testers

    For mouse UI I would just intercept mouse down in all cells in the row and flip the checkbox state for that row and return true in the event.

    That way the user can click anywhere in the row and change the checkbox state, but no row can be selected my mouse

    For keyboard navigation I would use Tim's suggestion to paint the background AND text so as not to the selection. Also in the key down event check for space (spacebar) and if pressed toggle the checkbox state and return true

    -Karen

or Sign Up to reply!