Hi MVB,
A new update is available via syncmods (1.11) which includes the following change :
* Fixed listbox generating selection event on initialisation.
However, I would say your code example is flawed, since if you control-click a currently selected row, it deselects it, raising a selection event with -1 (i.e. no selection) in the eventdata, which will break your code.
Of course one argument is :
Should the listbox generate an event when you DEselect a row to have none selected, or should it do nothing.
I say it should. Why? Because if you want to enable/disable a button, for instance, depending on the current selection, by NOT having an event generated on deselection you would never know to disable the button...
rather change your code :
I would even disable the textfield when nothing is selected...
btw, if win32 / macos versions of MaxGUI don't raise an event on deselection, then I say that is a bug on those platforms.
Personally, you *want* as many events raised as possible.
:-)
A new update is available via syncmods (1.11) which includes the following change :
* Fixed listbox generating selection event on initialisation.
However, I would say your code example is flawed, since if you control-click a currently selected row, it deselects it, raising a selection event with -1 (i.e. no selection) in the eventdata, which will break your code.
Of course one argument is :
Should the listbox generate an event when you DEselect a row to have none selected, or should it do nothing.
I say it should. Why? Because if you want to enable/disable a button, for instance, depending on the current selection, by NOT having an event generated on deselection you would never know to disable the button...
rather change your code :
If EventSource()=Listbox Then If EventData() >= 0 Then SetGadgetText Textfield, GadgetItemText(Listbox, EventData()) Else SetGadgetText TextField, "" End If EndIf
I would even disable the textfield when nothing is selected...
btw, if win32 / macos versions of MaxGUI don't raise an event on deselection, then I say that is a bug on those platforms.
Personally, you *want* as many events raised as possible.
:-)