changing size of a slider using uicomponent and GUI Layout

조회 수: 9 (최근 30일)
Lisa
Lisa 2015년 6월 15일
댓글: sudarson sinha 2016년 10월 20일
I'm using GUI Layout and I have created a slider inside of a uicontainer. All of the functions work except I cannot change the size of the slider. I want it to fill the size of the uicontainer (its parent). I do not want to use positions I'd like the slider size to be relative. I have tried setting MinimumSize (during creation of the slider and after) and it works but is not enforced on the slider. I've also tried setting 'Height' and 'Width' (during creation of the slider and after) and am getting the following error:
K>> set(gui.slider, 'Height', 100) Error using javahandle_withcallbacks.javax.swing.JSlider/set Changing the 'Height' property of javahandle_withcallbacks.javax.swing.JSlider is not allowed.
Error in uicomponent>localSetData (line 720) set(jcomp,propName,propValue);
Error in uicomponent>@(h,v)localSetData(h,v,jcomp,thisFieldName) (line 249) msp.SetMethod = @(h,v)localSetData(h,v, jcomp,thisFieldName);
Could someone tell me how to change the size of the slider? Or if it is impossible and I'm wasting my time trying...

답변 (1개)

sicilian27
sicilian27 2015년 6월 15일
It is my understanding that you can only make the slider fit a parent on the axis on which the bar slides. You can do this by setting the 'Units' property of the slider to 'normalized' and setting 'Position' property to something like [0 .5 1 0] or [.4 0 0 1] depending on which way you would like to orient it. This will allow the slider to move with the parent panel.
Unfortunately, I don't think you can change the width of the slider simply using uicontrol. However, there may be ways around that of which I am not aware.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by