%
% user_menu 
%
%  Demonstrate that shortcuts {'e','f','t'} don't work
%  properly.
%
%  Try shortcuts using 'Alt + ...'.
%  Shortcuts {'e','f','t'} need to be hidden twice as they are part of the
%  figure's standard menubar.
%  Use the last entry 'Toggle menubar' to watch the effect more clearly.
%
%  Looks like a bug, doesn't it?
%

function user_menu(varargin)

  hdf = figure(4711);

  if isempty(get(hdf,'userdata'))

    scr = get(0,'screensize'); 
    sze = scr(3:4).*[3,1]/4;
    cor = [4,-80];              % X & Y need to be corrected
                                % as frame & height of menubar are not
                                % included  
    pos = [([1,(scr(4) - sze(2))] + cor),sze];

    set(hdf,'interruptible',  'off',...
            'menubar',        'none',...
            'name',           'Shortcuts in User Menus',...
            'numbertitle',    'off',...
            'position',       pos,...
            'sizechangedfcn', 'refresh(gcbf);',...
            'userdata',       0);
    lbl = { '&Alfa',    '&Bravo',    '&Charlie', '&Delta',...
            '&Echo',    '&Foxtrot',  '&Golf',    '&Hotel',...
            '&India',   '&Juliett',  '&Kilo',    '&Lima',...
            '&Mike',    '&November', '&Oscar',   '&Papa',...
            '&Quebec',  '&Romeo',    '&Sierra',  '&Tango',...
            '&Uniform', '&Victor',   '&Whiskey', '&X-ray',...
            '&Yankee',  '&Zulu' };
    for i = 1:length(lbl)
      hdm = uimenu(hdf,'label',lbl{i});
            uimenu(hdm,'label','&Okay');
    end
    cbk   = ['if get(gcbf,''userdata''); ',...
             'set(gcbf,''menubar'',''none'',''userdata'',0); ',...
             'else; ',...
             'set(gcbf,''menubar'',''figure'',''userdata'',1); ',...
             'end'];
    uimenu(  'label',   'Toggle menubar',...
             'callback',cbk);
  end

end