File Exchange

image thumbnail

smart_scrollbars fixes Matlab's listbox/editbox scrollbars to only show as needed

version (6.9 KB) by Yair Altman
smart_scrollbars fixes Matlab's listbox/editbox scrollbars that display even when they are unneeded


Updated 20 Apr 2016

View License


Input parameters:
hContainer - optional handle to container (e.g., panel, tab or figure). Default = current figure (gcf)

Note: additional inputs may be specified and are ignored - this is useful for specifying smart_scrollbars as the target callback function (e.g., of the container's SizeChangedFcn). See example below.

Output parameters:

smart_scrollbars; % fixes the scrollbars in all listboxes/editboxes in currrent figure
smart_scrollbars(hPanel); % fixes the scrollbars in all listboxes/editboxes in hPanel container
smart_scrollbars(hListbox); % fixes the scrollbars of the specified listbox
set(gcf,'SizeChangedFcn',@smart_scrollbars) % fix scrolling whenever the figure resizes

Technical explanation & details:

This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7+, but use at your own risk!

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

Comments and Ratings (0)

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

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor