PopupMenu fires Change() on Click instead of selection?

  1. 3 months ago

    Tim J

    Jun 6 Pre-Release Testers, Xojo Pro Dehydrating in AZ

    In 2019r1.1, I've just noticed that the Change even is being called when the user clicks instead of when they make a selection.

    According to the language reference and my memory, the Change event should only fire to indicate that the selection has changed.

    Me, or bug?

    Okay - this is cruel - the issue is actually that the Listbox contents are updating because the PopupMenu drops down over the ListBox and that is what's causing the "apparent" change. What I was checking was the CellBackgroundPaint event ...

  2. Alberto D

    Jun 6 Pre-Release Testers

    Is this happening regardless of platform?

    I did a simple test on mac 10.12.6 and Change fires only after I select a value (same or other). I expected not to fire if it is the same value, but I guess I need to handle that myself.

  3. Michel B

    Jun 6 Pre-Release Testers, Xojo Pro RubberViews.com

    Popupmenu behaves a bit differently on Mac and Windows. On Windows, it fires when selection changes. On Mac, only when the user clicks.

  4. Norman P

    Jun 6 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @Tim J In 2019r1.1, I've just noticed that the Change even is being called when the user clicks instead of when they make a selection.

    According to the language reference and my memory, the Change event should only fire to indicate that the selection has changed.

    Me, or bug?

    you
    it works as expected here

    really simple app
    new desktop app
    add popupmenu
    add open event to popupmenu with

    for i as integer = 1 to 10
        me.addrow str(i)
    next

    to the popupmenu add change, mousedown and mouseup events
    in each put

    system.debuglog currentmethodname

    run and select different items

    change never happens just on mouse down here

    now if you have added those events and returned true in mousedown you can mess up normal functioning

  5. Tim J

    Jun 6 Pre-Release Testers, Xojo Pro Dehydrating in AZ
    Edited 3 months ago

    Okay -

    The ONLY event added is Change()

    macOS - happens when the menu is closed (selection is made) - regardless of whether the selection changed
    Windows - Happens on click, regardless of user selection
    Linux - Happens on click, regardless of user selection

    That just doesn't seem right on any of them.

  6. Tim P

    Jun 6 Pre-Release Testers Rochester, NY
    Edited 3 months ago

    @Tim J regardless of whether the selection changed
    That just doesn't seem right on any of them.

    This is how it has always behaved on Mac. If you need to determine whether the next value is different from the previous value you can implement that protection. We don't have a SelectionMade event, so ignoring a selection just because it was the same value would make the Change event less useful.

  7. Norman P

    Jun 6 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    just ran my same little sample on windows & I get the change event after a selection has been made
    not right when clicked

    this is in 2019r1.1 on Windows 10

  8. Norman P

    Jun 6 Pre-Release Testers, Xojo Pro great-white-software.com/blog
    Edited 3 months ago

    mint 19 with 2019r1.1 I dont get mousedown but do get a change after an item has been selected
    not right when the person clicks on it

    you dont have code in a got focus or mouse down that changes the listindex do you ?

    on windows & macOS using mousedown to store the current listindex would make it pretty simple to create a subclass that raise a "SelectionActuallyChanged" event
    and you could do the same for keypresses since the popupmenu can get focus & be triggered by the keyboard

    not getting the mousedown on linux makes that more challenging
    filed Feedback Case #55950

  9. Tim J

    Jun 6 Pre-Release Testers, Xojo Pro Answer Dehydrating in AZ

    Okay - this is cruel - the issue is actually that the Listbox contents are updating because the PopupMenu drops down over the ListBox and that is what's causing the "apparent" change. What I was checking was the CellBackgroundPaint event ...

or Sign Up to reply!