% Thanks to <a href="http://www.mathworks.com/matlabcentral/profile/authors/3354683-yaroslav">Yaroslav Don</a> for his assistance in updating cursorbar for
% MATLAB Graphics and for his contribution of new functionality.
% Copyright 2003-2016 The MathWorks, Inc.
% check the figure
hFig = ancestor(hThis,'figure');
%
if isempty(hFig) || ~ishghandle(hFig)
% probably, happens during loading process
% exit to prevent MATLAB from crushing
uictxtmenu = gobjects(0);
return
end
% set context menu
uictxtmenu = uicontextmenu('Parent',hFig);
uictxtmenu.Serializable = 'off'; % don't save to file
% define menu properties
menuprops = struct;
menuprops.Parent = uictxtmenu;
menuprops.Serializable = 'off'; % don't save to file