I have 2 list boxes, changing row of the 1. listbox displays some data in the 2. listbox.
now if I do not change row but click the RMB (right mouse button) the change event fires again.
is that a normal behaviour of the change event by using the RMB on the same row ?
You āchangeā the selected row (even if it is the same one).
Just add a property IndexOfCurrentlyDisplayedRow to keep track of which data are shown (generally called a āflagā as it flags the current state), and check in your event if your clicked row is already being displayed.
thanks Markus,
So you are saying we have to keep track ourself if a row has really changed ? what a pity, my regards to Xojo ā¦
will try to use a flag
How do I define a GOOD solution? One that does not cause more problems further down the line.
Anthony, youāre an MVP, so your word carries a bit more weight than others - for me that gives you the obligation to come up with GOOD solutions, not workarounds with (for beginners) unforeseen side effects. How many have to discover that āsuddenlyā their contextual menu no longer works before they get a good solution?
Which is why I made sure to mention that this was a result of supporting Contextual menus before making the suggestion I did. Weāre getting off-topic, though. Please feel free to offer an alternative solution.
I tried your recommendation with the IsContextClick ( which I did not know, but who knows everything ) and that is working for me, thanks very much
I put it on top of the change row event of the listbox and returned true.
so far so good.
Now I have to do the same for all my list boxes which have a ContextualMenu ā¦
does it happen because the listbox is inherited and handles the change event, but the base listbox handles the RMB ? you know what I mean ?
Also with Anthonyās solution you have to put the code into every single Listbox - and when there is a bug or Xojo changes something you have to change all of them.
With my subclass solution you just set the Listbox to the customised superclass, the code only exists ONCE in your app (so easy to maintain), and it plays nice with the context menu.