Info

This question is closed. Reopen it to edit or answer.

Location of warning in code doesn't seem to correspond with actual warning

2 views (last 30 days)
I have a GUI that contains listboxes, radio buttons, push buttons and other edit boxes. I have a piece of code that updates an edit box in the Matlab GUI every so often to let the user know how long before the GUI will refresh (or update) the information displayed in listboxes. Every so often, I get the warning:
Warning: single-selection listbox control requires that Value be an integer within String range Control will not be rendered until all of its parameter values are valid
This warning shows up with the line number within the code that is associated with this warning. However, the piece of code associated with this line number seems to have little to do with the warning message. In fact, it is simply a "pause" statement. This pause statement is located inside a while loop with other things that neither change nor query any listbox handle inside my GUI.
So... I have a hard time understanding why I would receive this error when nothing should be changing inside any of my listboxes while this piece of code is executing.

Answers (1)

Walter Roberson
Walter Roberson on 3 Oct 2011
pause() is the first place that it actually tries to render the GUI, and thus is the first place that it cross-checks everything. It is not an error or warning to temporary have the settings in an inconsistent state, as long as you fix the settings before the control is rendered via pause() or drawnow() or because figure() was called.
  1 Comment
Dr. Seis
Dr. Seis on 4 Oct 2011
I understand that... but if I have a "pause" statement immediately after a change in the listboxes and then there are no changes made to these listboxes before subsequent "pause" statements, then wouldn't you expect to recieve warnings on both the initial "pause" and the subsequent "pause" if there was indeed a problem? I only see the warning message on subsequent "pause" statements, which doesn't make sense to me. I don't understand how the settings can be consistent immediately after the listboxes are updated, but then inconsistent afterwards when there are no changes taking place inside those listboxes.
I wonder if I should just turn the listboxes into a multi-selection listbox and then set Value to "0" since they aren't meant to be interactive (just used to display/list things).

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!