File Exchange

image thumbnail


version (7.33 KB) by Jason Kinchen
A ScrollPanel object that can contain lightweight Handle Graphics objects.

1 Download

Updated 18 Dec 2010

View License

Standard Handle Graphics uipanels provide containment and groups axes and their children. The ScrollPanel provides the ability to define a scrollable area and the panel is the viewport onto that area.

Since Scrollpanel is not a built-in Handle Graphics object, objects must be parented to it explicitly. It has a 'handle' property for this purpose.

ScrollPanel does support the border properties of the uipanel object,
but in a slightly different way. The border of the ScrollPanel does not intrude upon the client area, but extends outward from it. The border of a panel is lightweight and would be obscured by the scrolling objects in the scroll area. The position of the object with the border may be set using the OuterPosition property.

An important point to note is that the ScrollPanel object has the same limitations as the Handle Graphics uipanel object which is used in its implementation. In terms of clipping. Heavyweight objects such as uicontrols will not be clipped and will scroll outside of the viewport.

Since scrolling will tend to move these heavyweight object outside the viewport position, care much be used to achieve the desired result.

The use of OpenGL and surface objects in general is also problematic since they are heavyweight. So, it is advisable to stick to 2D without transparency.

Cite As

Jason Kinchen (2020). ScrollPanel (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

ivan lipa

Do not work. In example:

Error using matlab.ui.container.Panel/addlistener
Event 'SizeChange' is not defined for class 'matlab.ui.container.Panel'.

Error in ScrollPanel (line 261)
addlistener(obj.hViewportPanel, 'SizeChange', @obj.resize);


Hello Jason,

fine object!

is it also possible to initialize the ScrollPanel with the horizontal slighter completely scrolled to the left, the vertical slighter completely scrolled to the top AND the scrolling panel with its top-left corner at the top-left corner of the viewport panel?

My purpose is to use the ScrollPanel in the middle of my GUI and to fill up with a dynamically number of listboxes and my users are used to look from the top to the bottom and from the left to the right.

PS: I know that heavyweight objects go over the border, but I`ll hide them with frames.

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Inspired: Interactive Stack Graph