attachScrollPanelTo - add scroll-panel to a uipanel or axes

버전 1.0.0 (80.3 KB) 작성자: Yair Altman
Places the specified control/uipanel inside a scroll-panel that automatically appears when the container shrinks (resizes)
다운로드 수: 368
업데이트 날짜: 2018/7/25

라이선스 보기

Syntax:
[hScrollPanel, hPanel] = attachScrollPanelTo(hObject);

Description:
attachScrollPanelTo places the specified control/uipanel handle in a scroll-panel (a Java JScrollPanel object). If the specified handle is not a uipanel, then it is placed inside a tightly-fitting borderless uipanel, which is then placed within the new scroll-panel.

The new scroll-panel automatically resizes with its containing figure/uipanel or other container (the specified handle's original parent). Scrollbars automatically appear as needed, when the container shrinks or expands.

The returned hScrollPanel can be seperately customized (for example, programmatically setting the viewport's ViewPosition): see usage examples below

The returned hPanel is the Matlab panel containing the input hObject. When hObject is a uipanel, hPanel==hObject; otherwise, hPanel is the tightly-fitting borderless panel that is created for the scroll-panel.

Calling attachScrollPanelTo with no input handle displays a demo.

Examples:
attachScrollPanelTo() %display the demo
attachScrollPanelTo(hPanel) %place the specified panel in a scroll-panel

hScroll = attachScrollPanelTo(hPanel);
hScroll.ViewOffset = [30,50]; %set viewport offset (30px right, 50px down)
set(hScroll, 'ViewOffset',[30,50]); %equivalent alternative

Limitations:
- HG2 figures created with GUIDE or the figure command - works ok
- HG2 figures created with AppDesigner or uifigure command - does NOT work
- HG1 figures created on R2014a or older - does NOT work

Technical details:
https://undocumentedmatlab.com/blog/scrollable-gui-panels

Disclaimer:
This utility relies on undocumented functionality. It works on Matlab R2014 onward, but may fail to work at some future release. Use at your own risk!

인용 양식

Yair Altman (2024). attachScrollPanelTo - add scroll-panel to a uipanel or axes (https://www.mathworks.com/matlabcentral/fileexchange/68325-attachscrollpanelto-add-scroll-panel-to-a-uipanel-or-axes), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2017b
R2014b 이상 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0