PopupMenu fires Change() on Click instead of selection?

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?

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.

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

[quote=440364:@Tim Jones]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?[/quote]
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

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.

[quote=440370:@Tim Jones] regardless of whether the selection changed
That just doesn’t seem right on any of them.[/quote]
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.

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

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 <https://xojo.com/issue/55950>

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 …