gui slider disappears from figure

5 visualizaciones (últimos 30 días)
Mads
Mads el 14 de Jun. de 2017
Comentada: Adam el 14 de Jun. de 2017
I have a script that when runs opens a gui. It has several sliders.
When I run the script with one particular input everything works fine.
When I run the script with another input one particular slider disappears once I start to assign entries to its handle, fx.:
set(slider,'Min',1)
I have followed this in debug mode, and I see that it is still supposed to be Visible (this entry is stil 'on')! It could be another entry that I change, and then it disappears. Also the position remains correct.
But as I said, if the input to the script is another, the troubled slider remains and works as it should.
According to another thread: I do set the units before the position...

Respuesta aceptada

Adam
Adam el 14 de Jun. de 2017
Problems with sliders disappearing usually come with a warning on the command line and are often associated with setting an illegal state where the min > max or the value does not fit within the specified range.
The fact you say this happens after
set(slider,'Min',1)
indicates this is the problem if e.g. max is 0.
When you are editing the min, max and value properties of a slider it is best to edit these all in one statement as e.g.
set( slider, 'Min', 1, 'Max', 2, 'Value', 1.5 )
and ensure that the min, max and value are valid with respect to each other.
  2 comentarios
Mads
Mads el 14 de Jun. de 2017
Adam, you were right about the max value being wrong. To compact three set()'s into one didn't help though. So it works again now. Thanks!
Adam
Adam el 14 de Jun. de 2017
No, setting all 3 at once will not help if they are not valid with respect to each other, but it does eliminate warnings being spewed to command line if you do them in succession and the slider is temporarily in an invalid state mid-way through.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by