Changeset 244 for trunk/src/msgbox_uvmat.m
- Timestamp:
- Apr 20, 2011, 12:51:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/msgbox_uvmat.m
r156 r244 38 38 39 39 % --- Executes just before msgbox_uvmat is made visible. 40 function msgbox_uvmat_OpeningFcn(hObject, eventdata, handles,title,display,default_answer )40 function msgbox_uvmat_OpeningFcn(hObject, eventdata, handles,title,display,default_answer,Position) 41 41 % This function has no output args, see OutputFcn. 42 42 43 43 % Choose default command line output for msgbox_uvmat 44 44 handles.output = 'Cancel'; 45 set(handles.figure1,'Units','pixels') 46 FigPos=[100 150 500 50];%default position 47 if exist('Position','var') 48 FigPos(1)=Position(1); 49 FigPos(2)=Position(2)-FigPos(4);% upper left corner set by input Position 50 set(handles.figure1,'Position',FigPos) 51 end 52 set(handles.OK,'Units','pixels') 53 set(handles.OK,'Position',[100 2 60 30]) 54 set(handles.OK,'FontSize',15) 55 set(handles.No,'Units','pixels') 56 set(handles.No,'Position',[200 2 60 30]) 57 set(handles.No,'FontSize',15) 58 set(handles.Cancel,'Units','pixels') 59 set(handles.Cancel,'Position',[300 2 60 30]) 60 set(handles.Cancel,'FontSize',15) 45 61 46 62 % Update handles structure … … 69 85 testCancel=0; %no cancel button 70 86 testinputstring=1; 87 case 'INPUT_TXT' 88 testinputstring=1; 71 89 otherwise 72 testinputstring=1; 90 % testinputstring=1; 91 icontype=''; 92 testinputstring=exist('default_answer','var'); 73 93 end 74 94 end … … 76 96 set(handles.text1, 'String', display); 77 97 end 98 % if testinputstring 99 % set(handles.edit_box, 'Visible', 'on'); 100 % else 101 % set(handles.text1, 'Position', [0.15 0.3 0.85 0.7]); 102 % end 78 103 if testinputstring 104 % set(handles.figure1,'Position',[40,80,20*length(default_answer),50]) 79 105 set(handles.edit_box, 'Visible', 'on'); 106 if ~exist('default_answer','var'); 107 default_answer=''; 108 end 109 set(handles.edit_box, 'String', default_answer); 110 if exist('Position','var') 111 if iscell(default_answer) 112 widthstring=max(cellfun('length',default_answer)); 113 heightstring=size(default_answer,1); 114 set(handles.edit_box,'Max',2); 115 else 116 widthstring=length(default_answer); 117 heightstring=1; 118 end 119 widthstring=max(widthstring,length(title)); 120 boxsize=[10*widthstring 20*heightstring];%size of the display edit box 121 set(handles.edit_box,'Units','pixels') 122 set(handles.edit_box,'FontUnits','pixels') 123 set(handles.edit_box,'FontSize',12) 124 set(handles.edit_box,'Position',[5,34,boxsize(1),boxsize(2)]) 125 FigPos(3)=10+boxsize(1); 126 FigPos(4)=36+boxsize(2); 127 FigPos(2)=Position(2)-FigPos(4)-25; 128 set(handles.figure1,'Position',FigPos) 129 end 130 % set(handles.figure1,'Position',[40,40,20*length(default_answer),50]) 80 131 else 81 132 set(handles.text1, 'Position', [0.15 0.3 0.85 0.7]); 82 133 end 83 if exist('default_answer','var') && testinputstring84 set(handles.edit_box, 'String', default_answer);85 end86 134 % Determine the position of the dialog - centered on the screen 87 FigPos=get(0,'DefaultFigurePosition');88 OldUnits = get(hObject, 'Units');89 set(hObject, 'Units', 'pixels');90 OldPos = get(hObject,'Position');91 FigWidth = OldPos(3);92 FigHeight = OldPos(4);93 ScreenUnits=get(0,'Units');94 set(0,'Units','pixels');95 ScreenSize=get(0,'ScreenSize');96 set(0,'Units',ScreenUnits);97 98 FigPos(1)=1/2*(ScreenSize(3)-FigWidth);99 FigPos(2)=2/3*(ScreenSize(4)-FigHeight);100 FigPos(3:4)=[FigWidth FigHeight];101 set(hObject, 'Position', FigPos);102 set(hObject, 'Units', OldUnits);135 % FigPos=get(0,'DefaultFigurePosition'); 136 % OldUnits = get(hObject, 'Units'); 137 % set(hObject, 'Units', 'pixels'); 138 % OldPos = get(hObject,'Position'); 139 % FigWidth = OldPos(3); 140 % FigHeight = OldPos(4); 141 % ScreenUnits=get(0,'Units'); 142 % set(0,'Units','pixels'); 143 % ScreenSize=get(0,'ScreenSize'); 144 % set(0,'Units',ScreenUnits); 145 % 146 % FigPos(1)=1/2*(ScreenSize(3)-FigWidth); 147 % FigPos(2)=2/3*(ScreenSize(4)-FigHeight); 148 % FigPos(3:4)=[FigWidth FigHeight]; 149 % set(hObject, 'Position', FigPos); 150 % set(hObject, 'Units', OldUnits); 103 151 104 152 % Show a question icon from dialogicons.mat - variables questIconData and questIconMap
Note: See TracChangeset
for help on using the changeset viewer.