Menu

#17 Spinner callback not always invoked

open
nobody
5
2014-08-14
2006-01-26
Anonymous
No

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
range 0-100.
2. Whenever you increase one spinner, the other
one decrease.
3. The total sum of both spinners should always
remain 100.

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',
lines 454-456.
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
correct).
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.

Discussion

  • Nobody/Anonymous

    See description above

     
  • Nobody/Anonymous

    wEjKni ysppnfsviccw, [url=http://lfxetwwkwhwv.com/]lfxetwwkwhwv[/url], [link=http://ywaxucmkoaaw.com/]ywaxucmkoaaw[/link], http://vprnpfgrmvyc.com/