I’m populating a WebPopupMenu and then setting the .SelectedRowIndex to a desired index, but setting it programmatically doesn’t prompt the SelectionChanged Event (which I was hoping it would).
Is there a reliable (best) way to programmatically set the index and cause a SelectionChanged Event? Thanks!
I do hope the desktop framework behavior (change event means it changed) gets brought to Web. It is far easier to set a flag to ignore than it is to implement a workaround for it not firing.
Heck, you can use the Enabled property and you don’t even have to create anything
Couldn’t you just subclass the control, and replace the SelectedRowIndex with a computed property that Triggers the Server Event for the controlID & “SelectionChanged”? I use this method to force Xojo WebControls to fire events or in “make shift” custom-controls not using the webSDK (sometimes is MUCH faster and more efficient!). I will revisit this thread later but the process is not very difficult if you’ve worked with the WebSDK prior and current.
Here’s the fix as a demo in case anyone wants to learn how to force a control event to occur whenever desired in Web Edition API 2.0. (Great for when events just don’t fire on their own or are broken )
Please note that the new documentation system is incorrect regarding this item. It says that the event is fired when the selection is changed manually or in code. It also says that you should change it in code using “ListIndex,” which is no longer a property of WebPopupMenu in Web 2.0.
Should I file a Feedback report about the documentation? I am not sure what to do when the documentation is linked to an open bug report (it is still open as of today).
Also, any advice about whether I should anticipate that this bug gets fixed or not? I am moving some code from Web 1 to Web 2, and will have to rewrite a lot of it if it is not fixed (though maybe Matthew’s idea will make this a bit less grievous). On the other hand, if the bug is fixed at some point, I will have to rewrite it all again.
Maybe @Ricardo_Cruz can review the feedback cases. Consistency between Xojo platforms (Desktop/Web/Mobile) is important to be easy for us to use the same login going from/to platforms.
SelectionChanged should be firing if you change the index programmatically, to match how Desktop works. If it doesn’t in specific controls, please file a Feedback case, there are a few reported cases already fixed for next release.