www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevproject/gui_notessetup.m

    function gui_notessetup(~)
%GUI_NOTESSETUP  Pop up a dialog for changing the columns viewed for Notes
%
%  GUI_NOTESSETUP(MP)
%

%  Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.


% This function will create a small dialog for choosing which columns to
% view in the Notes list in the Model Browser.  The settings are saved in
% the mbc preferences

dlg = mbcgui.container.Dialog('Name','Notes Display Setup',...
    'Buttons','OK_CANCEL',...
    'Size',[200 250],...
    'Resize','off');
hFig = dlg.Figure;
xregpersistfigpos(hFig,'key','xregProjectNotesSetup','defaultpos',hFig.Position);
xregmoveonscreen(hFig);


infotxt = uicontrol('Parent',hFig,...
    'Style','text',...
    'HorizontalAlignment','left',...
    'String','Choose the information that you want to display in the project''s Notes list:');

frame = mbcgui.container.layoutpanel(...
    'Parent', hFig,...
    'BorderType', 'etchedin');

prfs = getpref(mbcprefs('mbc'),'mdevproject');
settings = prfs.NotesListColumns;
str = {'Note contents', 'User name', 'Company name', 'Department name', 'Contact Information', 'Date of note', 'Time of note'};
nChecks = length(settings);
hChecks = cell(nChecks,1);
for  k = 1:nChecks
   hChecks{k} = uicontrol('Parent',frame,...
      'Style','checkbox',...
      'String',str{k},...
      'Value',settings(k));
end
set(hChecks{1},'Enable','off');

grid = xreggridbaglayout(frame,...
   'dimension',[7 1],...
   'border', [5 5 5 5], ...
   'rowsizes',repmat(20,1,nChecks),...
   'elements',hChecks);
set(frame, 'LayoutComponent', {grid});

lyt = xreggridbaglayout(hFig,...
   'dimension',[2 1],...
   'rowsizes',[30 -1],...
   'gapy',5,...
   'gapx',7,...
   'elements',{infotxt,frame});

dlg.Content = lyt;
closeMode = dlg.showDialog();

if strcmpi(closeMode,'OK')
   vals = get([hChecks{:}],{'Value'});
   vals = [vals{:}];
   vals = (vals~=0);
   prfs.NotesListColumns = vals(:)';
   setpref(mbcprefs('mbc'),'mdevproject',prfs);
end
delete(dlg);