changing size of a slider using uicomponent and GUI Layout
7 次查看(过去 30 天)
显示 更早的评论
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
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!