Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
Description
This is a button component for SVG based icons. This provides a way to use SVG based icons in a button and customize the icon color as well as some other properties to give the button effects on interaction
Feedback
Please leave suggestions for more styling options or other feedback in the discussions tab.
Preview
Example
NB: This example is included in the examples folder. Because it relies on the mfilename('fullpath') command, the example will only work if the script is run from its original location.
f = uifigure('Name', 'Icon Button Demo');
gl = uigridlayout(f);
gl.ColumnWidth = {'1x', 120, '1x'};
gl.RowHeight = {'1x', 120, '1x'};
rootFolder = fileparts(fileparts(mfilename('fullpath')));
play_icon = fullfile(rootFolder, 'resources', 'icons', 'play-113.svg');
btn = IconButton(gl, ...
'Height', 100, ...
'Width', 100, ...
'Color', '#002054', ...
'SVGSource', play_icon);
btn.Layout.Row = 2;
btn.Layout.Column = 2;
btn.ButtonPushedFcn = @onButtonPushed;
function onButtonPushed(src, ~)
rootFolder = fileparts(fileparts(mfilename('fullpath')));
play_icon = fullfile(rootFolder, 'resources', 'icons', 'play-113.svg');
pause_icon = fullfile(rootFolder, 'resources', 'icons', 'pause-51.svg');
switch src.SVGSource
case play_icon
src.SVGSource = pause_icon;
case pause_icon
src.SVGSource = play_icon;
end
end
Zitieren als
Eivind Hennestad (2026). IconButton (App Component) (https://de.mathworks.com/matlabcentral/fileexchange/167901-iconbutton-app-component), MATLAB Central File Exchange. Abgerufen .
Allgemeine Informationen
- Version 1.1.3 (21 KB)
Kompatibilität der MATLAB-Version
- Kompatibel mit R2023a und späteren Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.1.3 | Fix background color behavior for MATLAB 2025a and later |
||
| 1.1.2 | Fix: Button will now update its background color when setting the component's BackgroundColor property |
||
| 1.1.1.1 | Update MATLAB Release Compatibility |
||
| 1.1.1 | Fix: Reinitialize internal memoized function on demand if invalidated by "clear all" etc |
||
| 1.1.0.5 | Change preview gif |
||
| 1.1.0.4 | Added preview gif |
||
| 1.1.0.3 | Update image |
||
| 1.1.0.2 | Update description |
||
| 1.1.0.1 | Updated thumbnail image |
||
| 1.1.0 | Improved update of SVG Icon by updating in Javascript using Data property
|
||
| 1.0.0 |
