Normalized Units for Programmatically added sliders

5 views (last 30 days)
Hi there. Sorry is this has been asked before.
I have a loop and within each loop, I want to add a slider to a panel. I want these sliders to resize with the figure and I can't find what property/properties I should use. Any help appreciated.
Here is my code.
for k = 1:length(handles.f.muscles)
sl = uicontrol(handles.pnl_sliderPanel,...
'Style', 'slider',...
'Max', 1,...
'Min', 0,...
'SliderStep', [0.05 0.2],...
'Position', [10 (700-k*position) 150, 30],...
'Units', 'normalized');
end
  1 Comment
Jan
Jan on 9 Jan 2013
Does the panel resize with the figure? It should, when it's 'Units' are 'normalized' also.

Sign in to comment.

Accepted Answer

Jan
Jan on 9 Jan 2013
Actually setting the 'Units' after the 'Position' should work. But try this:
for k = 1:length(handles.f.muscles)
sl(k) = uicontrol(handles.pnl_sliderPanel,...
'Style', 'slider',...
'Max', 1,...
'Min', 0,...
'SliderStep', [0.05 0.2],...
'Position', [10 (700-k*position) 150, 30]);
end
set(sl, 'Units', 'normalized');

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by