uiframe
Version 0.2.1 (10.3 KB) by
Clas Nordell
Add frame to figure, panel or tab. Uses axes & rectangle or patch in a class. Non-rectangular frame by patch.
uiframe class
Add a frame to figure, tab or panel. Uses axes with rectangle or patch to make a simple frame. Frame is placed behind other UI elements. Calculates a frame around all object positions provided. uiframe cannot be a parent.
Properties and their default values
FrameWidth = 2
FrameColor = 'r'
FrameLineStyle = '-' ('-', '--', ':', '-.' or 'none')
FrameAlignVertexCenters = 'off' (See rectangle, patch)
FrameExpand = 0 (expand frame, 1 or 2 elements)
FrameFillColor = 'none'
FrameRendering = 'rectangle' ('rectangle', 'patch or 'polygon')
FramePositions = [] (positions from other UI element for frame calc, size (:,4) [ x y w h ])
FramePolygon = [] (polygon for a frame of any shape, XY pairs per row (:,2). Does not close polygon)
FrameShape = 'Individual' ('OuterLimits', 'RubberBand', 'ConvexHull', 'Orthogonal', 'Boundary', 'Individual')
FrameShrinkFactor = 0.2 (For FrameShape = 'Boundary')
FrameLineJoin = 'miter' ('miter','round','chamfer') (only for patch and polygon, see patch)
FrameCurvature = 0 (range[0..1], 1 or 2 elements. See rectangle. Also works for some patch styles)
FramePatchCornerRadius = 'Same' ('Same','Different'. Size of curvature radius for 'patch', 'Orthogonal')
FrameVisible = 'on'
FrameParent
UserData = []
tag = '' (small t! Tag cannot be used)
Read-only properties:
Type = 'uiframe'
Style = 'uiframe'
Functions:
Refresh (refresh uiframe. Use after setting Parent or Visible)
Uses superclass matlab.graphics.chartcontainer.ChartContainer. This one give properties Position, Units, Parent, Visible, ...
USAGE examples:
uf=uiframe(gcf,'Units','pixels','Position',[10 10 80 30],'FrameCurvature',0.2);
uf.FrameExpand = 2;
uf.FrameParent = OTHER_FIGURE_HANDLE;
uf.Parent = YET_ANOTHER_FIGURE_HANDLE;
uf.Refresh;
uf=uiframe(gcf,'Units','pixels','FramePositions', [ui1.Position;ui2.Position],'FrameRendering','patch');
uf.FrameShape = 'RubberBand';
uf.FrameExpand = [10 20];
LIMITATIONS:
- To be able to create new uiframes HandleVisibilty is set to OFF.
This will make clf to fail, and findobj will not find uiframe
(use findall). Always assign uiframe to a variable and use delete() to
remove. Or use delete(findall(FIGUREHANDLE,'Type','uiframe'))
- Setting HandleVisibilty to ON, and then to OFF does not work. It is not
allowed per the superclass.
NOTE: With HandleVisibilty ON there is a risk any plot command without
an axes specified plots into the uiframe, destroying the uiframe object.
- Normally, do not use properties 'Parent' and 'Visible' as they do not
call the update(obj) routine. If using these, call the uiframe class
Refresh function, e.g. with a uiframe in variable uf, run uf.Refresh;
- All basic properties are inheritated from superclass, and are therefore
akward for this class. To get wanted result, set properties explicitly.
- Tag cannot be used as it for some reason is set as read-only in
superclass. The property tag (small t) included but not that useful.
NOTE: Consider to use annotation for frames not using features in uiframe.
uiframeDemo:
Cite As
Clas Nordell (2026). uiframe (https://www.mathworks.com/matlabcentral/fileexchange/106895-uiframe), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2021a
Compatible with R2020a and later releases
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 0.2.1 | new image |
||
| 0.2.0 | New features; different expand X and Y, patch rendering for non-square frames, polygon set by user |
||
| 0.1.1 | add demo again.. |
||
| 0.1.0 | Add FrameExpand property and Refresh function. Help text adjustments |
||
| 0.0.2 | Demo fix. |
||
| 0.0.1 | Set correct MATLAB Release Compatibility |
||
| 0.0.0 |