When I use a spinner with limits, the spinner's
callback function is not always executed in response
to a spinning event.
I have made a small sample (file 'Bug.cpp'):
1. Two integer spinners, each limited in the
2. Whenever you increase one spinner, the other
3. The total sum of both spinners should always
In order to invoke the bug, do the following:
1. Spin spinner #2 down to 0 (spinner #1's value
is now 100).
2. Edit spinner #2's textbox and set it to 2
(spinner #1's value is now 98).
3. Spin spinner #2 again to 0 (spinner #1's
value remains 98).
This is my analysis:
1. After you edit the textbox and set it to
2, 'last_int_val' remains 0.
2. When you spin again, 'int_val' is set to 0,
and turns equal to 'last_int_val'.
3. As a result, the function 'do_callbacks'
returns without executing the callback.
See file 'glui_spinner.cpp', function 'do_callbacks',
One possible solution is to disable the above lines.
The right solution would probably be to
update 'last_int_val' when the spinner's text is
changed through the textbox (assuming my analysis is
Note that if you set the value to more than 2, then
the bug does not occur. I believe that 'int_val'
doesn't reach 0 in this case, but I have not
investigated that to full extent.