Why does 'Position' property not change the width of uicontrol slider?
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Pavel
 el 5 de Oct. de 2016
  
    
    
    
    
    Comentada: Walter Roberson
      
      
 el 6 de Oct. de 2016
            Hello, I am trying to change the width of a slider in a simple way:
f = figure;
s = uicontrol('Parent',f,'Style','slider','Position',[100,100,200,10]);
s.Position(4) = 100; 
s.Position(4) = 0;
But the slider only changes its position and doesn't change the size. Even if I set the width to zero. While Position(1:3) works properly. What am I doing wrong? Matlab R2016a. Mac OS 10.11.6. Thank you in advance.
2 comentarios
  Robert
      
 el 5 de Oct. de 2016
				For what it's worth, this works fine (changes the height) in R2016a on Windows 10.
Do you get the same behavior with the following?
set(s,'Position',[100,100,200,100])
Respuesta aceptada
  Walter Roberson
      
      
 el 5 de Oct. de 2016
        On my OS-X (Yosemite) system, R2016a or R2016b, changing the 4th value has the visual appearance of changing the height at which the slider is drawn.
It looks to me as if the explanation is that OS-X is always rendering the slider itself as the same height, and what you adjust by changing the 4th parameter is the size of the box it is rendered in.
2 comentarios
Más respuestas (1)
  Matthew Eicholtz
      
 el 5 de Oct. de 2016
        The width of the slider is the third element of the Position vector, not the fourth, which is height. Try something like:
s.Position(3) = 100;
to see if the width changes.
Ver también
Categorías
				Más información sobre Matrices and Arrays en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



