What is the greater purpose of the "int retval" parameter within uiDefButF()?

At first glance, it looks like it is supposed to be the biggest defining factor for creating different types of buttons. This is because, at least, some of int retval arguments(e.g. B_TRANSFORM_PANEL_MEDIAN) describe the most significant aspects of the button they pertain to. However, I only actually see the value purposefully used within ui_but_equals_old() and UI_but_return_value_get()

I understand that within uiDefButF(), ultimately retval merely gets assigned to uiBut* but->retval = retval; BUT what is it’s greater purpose ??

If you have an event handler for multiple buttons set via UI_block_func_handle_set, the callback can use this to tell which button was pressed since one of it’s arguments is the buttons retval.

1 Like