?? uitleg.m
字號:
function uitleg(titleStr,helpStr);% UITLEG Utility function for displaying help text conveniently.% Adapted gor GUI% First turn on the watch pointer in the old figureoldFigNumber=watchon;% If the Help Window has already been created, bring it to the front[existFlag,figNumber]=figflag('GUI Info Window',1);newHelpWindowFlag=~existFlag;if newHelpWindowFlag, position=get(0,'DefaultFigurePosition'); position(3:4)=[450 380]; figNumber=figure( ... 'Name','GUI Info Window', ... 'NumberTitle','off', ... 'HandleVisibility','callback', ... 'menubar','none',... 'Visible','off', ... 'Position',position, ... 'Colormap',[]); %=================================== % Set up the Help Window top=0.95; left=0.05; right=0.75; bottom=0.05; labelHt=0.05; spacing=0.005; % First, the Text Window frame frmBorder=0.02; frmPos=[left-frmBorder bottom-frmBorder ... (right-left)+2*frmBorder (top-bottom)+2*frmBorder]; uicontrol( ... 'Style','frame', ... 'Units','normalized', ... 'Position',frmPos, ... 'BackgroundColor',[0.5 0.5 0.5]); % Then the text label labelPos=[left top-labelHt (right-left) labelHt]; ttlHndl=uicontrol( ... 'Style','text', ... 'Units','normalized', ... 'Position',labelPos, ... 'BackgroundColor',[0.5 0.5 0.5], ... 'ForegroundColor',[1 1 1], ... 'String',titleStr); txtPos=[left bottom (right-left) top-bottom-labelHt-spacing]; txtHndl=uicontrol( ... 'Style','edit', ... 'Units','normalized', ... 'Max',20, ... 'HorizontalAlignment','left',... 'String',helpStr, ... 'BackgroundColor',[1 1 1], ... 'Visible','on', ... 'Position',txtPos); %==================================== % Information for all buttons labelColor=[0.8 0.8 0.8]; top=0.95; bottom=0.05; yInitPos=0.80; left=0.80; btnWid=0.15; btnHt=0.10; % Spacing between the button and the next command's label spacing=0.05; %==================================== % The CONSOLE frame frmBorder=0.02; yPos=bottom-frmBorder; frmPos=[left-frmBorder yPos btnWid+2*frmBorder 0.9+2*frmBorder]; uicontrol( ... 'Style','frame', ... 'Units','normalized', ... 'Position',frmPos, ... 'BackgroundColor',[0.5 0.5 0.5]); %==================================== % All required BUTTONS % The help buttons uicontrol( ... 'Style','text', ... 'Units','normalized', ... 'Position',[left 0.90 btnWid 0.04], ... 'BackgroundColor',[0.5 0.5 0.5], ... 'ForegroundColor',[1 1 1], ... 'String','- Help Menu -'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.85 btnWid 0.04], ... 'String','General', ... 'Callback','guihelp(''help'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.80 btnWid 0.04], ... 'String','Main', ... 'Callback','guihelp(''mainhelp'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.75 btnWid 0.04], ... 'String','Image', ... 'Callback','guihelp(''imagehelp'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.70 btnWid 0.04], ... 'String','Settings', ... 'Callback','guihelp(''settingshelp'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.65 btnWid 0.04], ... 'String','Functions', ... 'Callback','guihelp(''functionshelp'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.60 btnWid 0.04], ... 'String','Fit Controls', ... 'Callback','guihelp(''fithelp'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.55 btnWid 0.04], ... 'String','Fit Models', ... 'Callback','guihelp(''modelhelp'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.5 btnWid 0.04], ... 'String','Extras', ... 'Callback','guihelp(''extrashelp'')'); uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.4 btnWid 0.04], ... 'String','About', ... 'Callback','guimap(''aboutgui'');'); %==================================== % The CLOSE button callbackStr= ... ['f1=gcf; f2=gpf; set(f1,''Visible'',''off'');', ... 'if f1~=f2, figure(f2); end']; uicontrol( ... 'Style','pushbutton', ... 'Units','normalized', ... 'Position',[left 0.05 btnWid 0.10], ... 'String','Close', ... 'Callback',callbackStr); hndlList=[ttlHndl txtHndl]; set(figNumber,'UserData',hndlList)end;% Now that we've determined the figure number, we can install the% Desired strings.hndlList=get(figNumber,'UserData');ttlHndl=hndlList(1);txtHndl=hndlList(2);set(ttlHndl,'String',titleStr);set(txtHndl,'String',helpStr);set(figNumber,'Visible','on');% Turn off the watch pointer in the old figurewatchoff(oldFigNumber);figure(figNumber);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -