Warning for uicontrol's ListboxTop value; listBox does not appear

2 次查看(过去 30 天)
Hallo everyone, this is my problem. i have a gui code that creates this .fig. The thing is that there sould be a listbox at the top left side of the window, next to the second one. At the command window there is a warning that says "Warning: This uicontrol's ListboxTop value (191) must be within the String range (1:57) Control will not be rendered until all of its parameter values are valid "
The thing is, that I have this problem only when using matlab2016a. In matlab2011a, there was no such a problem. Any ideas how to fix it?
thank you a lot.

回答(1 个)

PG_Dev
PG_Dev 2017-11-22
编辑:PG_Dev 2017-11-24
Rania,
Good question.
Your current listbox in the GUI seems to have at-least 191 values but the second one has a max range of 57. Matlab GUI looks for the default value(or entry) which will be selected in the listbox before it creates it. You might have selected the 191st entry in the first listbox and that value could be taken by Matlab as the default selection value when it attempts to create it but you have populated the second listbox with only 57 values.
To workaround this issue, immediately after intializing (or re-intializing after you re-populate) any listbox (or also a pop-up/drop-down menu for that matter) use the following statement to reset the default selection to the first value.
set(Your_Listbox_Handle, 'Value', 1);
Let me know if it worked.
Regards
PG

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by