Add cut push button to figure

조회 수: 1 (최근 30일)
D.
D. 2011년 7월 28일
How can I add a cut button to my figure?
E.g. for getting file open and save buttons, I use this code:
audiotb = uitoolbar(this.FigureHandle);
tth = findall(this.FigureHandle, 'Type', 'uitoolbar');
ttb = findall(tth, 'Type', 'uipushtool');
fo = findobj(ttb, 'Tag', 'Standard.FileOpen');
set(fo, 'Separator', 'on', ...
'TooltipString', 'Öffnen', ...
'ClickedCallback', @(hobj, evd) fileOpenCallback(this));
copyobj(fo, audiotb);
fo = findobj(ttb, 'Tag', 'Standard.SaveFigure');
set(fo, 'TooltipString', 'Speichern', ...
'ClickedCallback', @(hobj, evd) fileWriteCallback(this));
copyobj(fo, audiotb);
Is there something like Standard.Cut?

채택된 답변

D.
D. 2011년 7월 28일
OK, I solved the problem using uipushtool.
[cd,~,alpha] = imread('icons/cut.png');
cd = double(cd) / 255;
cd(~alpha) = NaN;
uipushtool(audiotb, 'CData', cd, ...
'TooltipString', 'Ausschneiden', ...
'ClickedCallback', @(hobj, evd) cutCallback(this));
Nice! Thank me very much!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by