Jump to content

[SOLVED] Listbox GUI_CHANGED callback not called when removing current item


photo

Recommended Posts

Posted

I have a Listbox with a callback attached to the GUI_CHANGED event. Clicking to change the selection results in the callback function being called as expected.

I also have functionality to remove the currently selected item from the Listbox, which of course causes the selection to change. I would expect indirectly changing the selection in this manner to result in the GUI_CHANGED callback being fired, but this is not the case. I must call my callback manually.

 

Posted

Hello, Adam!

 

WidgetListBox will fire CHANGED callback only when its selection changes, not the contents. So in your case consider firing custom callback manually.

Posted

I may not have been clear.

 

I wouldn't expect a callback to be fired simply when the contents change. However, in the case where you delete the same item as the one currently selected, that results in the listbox having a new selection after the delete finishes. The selection has changed, but the GUI_CHANGED callback is not fired.

 

e.g. if you have "foo", "bar" and "qux" in a listbox, clicking and selecting "bar" will fire the GUI_CHANGED callback. Calling removeItem(1) while "bar" is still selected will remove "bar" from the listbox and cause "foo" to be the newly selected item. I would expect the GUI_CHANGED callback to be fired here as a selection change has occured, but it does not.

Posted

Thanks for clarification!

 

Now that makes much more sense and indeed callback is not firing. Passed that to devs, not ETA on that unfortunately.

Posted

Okay, thank you. Easy to work around in the meantime.

×
×
  • Create New...