Normalized Units for Programmatically added sliders

조회 수: 17 (최근 30일)
Felix  Felix Mr (CMP)
Felix Felix Mr (CMP) 2013년 1월 9일
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
Jan
Jan 2013년 1월 9일
Does the panel resize with the figure? It should, when it's 'Units' are 'normalized' also.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2013년 1월 9일
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');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by