Skip to content

Commit

Permalink
esfit: ContextMenu backwards compatilibility bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stestoll committed Sep 10, 2022
1 parent c275292 commit 47b6f9a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions easyspin/esfit.m
Original file line number Diff line number Diff line change
Expand Up @@ -2192,14 +2192,19 @@ function setupGUI(data)

copymenu = uicontextmenu(hFig);

if ~verLessThan('Matlab','9.2') % >R2016b
% In R2016b, uimenu does not support Text, and uicontrol does
% not support ContextMenu.
uimenu(copymenu,'Text','Copy to clipboard','Callback',@copyLog);
hLogBox.ContextMenu = copymenu;
% Before R2017b (9.3), uimenu used Label instead of Text
if verLessThan('Matlab','9.3')
menuTextProperty = 'Label';
else
uimenu(copymenu,'Label','Copy to clipboard','Callback',@copyLog);
menuTextProperty = 'Text';
end
uimenu(copymenu,menuTextProperty,'Copy to clipboard','Callback',@copyLog);

% Before R2020a (9.8), uicontrol used UIContextMenu instead of ContextMenu
if verLessThan('Matlab','9.8')
hLogBox.UIContextMenu = copymenu;
else
hLogBox.ContextMenu = copymenu;
end

drawnow
Expand Down

0 comments on commit 47b6f9a

Please sign in to comment.