WebListBox SelectionChanged not firing

  1. 7 days ago

    Charles W

    May 19 Pre-Release Testers, Xojo Pro Virginia

    Hi all,
    I know this has been asked before, but I didn't see a resolution so I'm pinging to see if anything new has been discovered.

    I have a WebListBox inside a WebContainer control. The container has a MouseUp handler which is working fine. However, with that handler installed, the listbox never fires SelectionChanged (or CellClick for that matter).

    This is presumably because the container is swallowing the mouse events. However other controls (buttons, for example) work fine.

    Is there any way to make the WebListBox work in a container control? Maybe some way to bubble the event to the listbox? How do people deal with this?

    Thanks!
    Xojo 2017r1.1 on Mac OS 10.11.6

  2. Louis D

    May 19 Pre-Release Testers, Xojo Pro Answer Montreal, QC, Canada
    Edited 7 days ago by Louis D

    I have several weblistboxes within container controls. They work well. I would think that you are right and the mouseup event handler is the cause of your issues.

    Here is a thought. I would work reverse what you are suggesting. I don't know what the mouseup event is supposed to do so this idea may well be totally irrelevant and not applicable. Here it goes: you could replace the container control mouseup event handler with a method that you would call from controls within the container control. For example, your weblistbox' mouseup (or selectionchanged, even) event could call the method on the container control, passing X, Y and details as parameters. There are certainly more elegant ways of doing this. The idea is to replace the problematic event handler with a method that you call from controls within the container.

  3. 6 days ago

    Charles W

    May 20 Pre-Release Testers, Xojo Pro Virginia

    @LouisDesjardins : great idea, thank you!

    I did exactly as you suggested: I put a mouseup handler into each control in the container. They all called the same container method. And I removed the mouseup handler from the container itself.

    This method works as long as there isn't too much "white space" in the container. If the user clicks on the background of the container, there's no handler so nothing happens. I tried putting a rectangle behind all other controls and adding a handler to the rectangle, but that approach had the same problem as putting the handler into the container.

    If I put a mouseDOWN event into the listbox, this event fires but the listbox still doesn't highlight the selected row. I suppose I could compute the row from the coordinates passed in the mousedown event, but that seems pretty tedious and probably would require keeping track of the first visible row, and then going through and testing each row (since rows can be of different heights). This is something the framework should be doing, IMHO.

    I think this is a bug or architectural problem with the way container events are handled.

or Sign Up to reply!