3
3
% Properties that correspond to app components
4
4
properties (Access = public )
5
5
StartUpAppUIFigure matlab.ui.Figure
6
- TabGroup matlab.ui.container.TabGroup
7
- WelcomeTab matlab.ui.container.Tab
8
- Image matlab.ui.control.Image
9
- READMEButton matlab.ui.control.Button
10
- ReviewUsButton matlab.ui.control.Button
11
- MainMenuButton matlab.ui.control.Button
12
- WelcomeTitle matlab.ui.control.Label
13
- TabReview matlab.ui.container.Tab
6
+ FeedBackPanel matlab.ui.container.Panel
7
+ FeedBackGrid matlab.ui.container.GridLayout
8
+ ReviewTitle matlab.ui.control.Label
9
+ ReviewText matlab.ui.control.Label
14
10
OtherButton matlab.ui.control.Button
15
11
StudentButton matlab.ui.control.Button
16
12
FacultyButton matlab.ui.control.Button
17
13
Q1 matlab.ui.control.Label
18
- ReviewTitle matlab.ui.control.Label
19
- ReviewText matlab.ui.control.Label
14
+ WelcomePanel matlab.ui.container.Panel
15
+ WelcomeGrid matlab.ui.container.GridLayout
16
+ WelcomeTitle matlab.ui.control.Label
17
+ CoverImage matlab.ui.control.Image
18
+ ReviewUsButton matlab.ui.control.Button
19
+ READMEButton matlab.ui.control.Button
20
+ MainMenuButton matlab.ui.control.Button
20
21
end
21
22
22
23
23
24
properties (Access = private )
24
25
GitHubOrganization = " MathWorks-Teaching-Resources" ; % Description
25
26
GitHubRepository = " Multivariable-Space-and-Functions" ;
27
+ InitPosition ;
26
28
end
27
29
%% How to customize the app?
28
30
%{
33
35
1. Change "Module Template" in app.WelcomeTitle by your module name
34
36
2. Change "Module Template" in app.ReviewTitle by your module name
35
37
3. Change the GitHubRepository (line 25) to the correct value
36
- 4. Change image in app.Image by the cover image you would like for your
38
+ 4. Change image in app.CoverImage by the cover image you would like for your
37
39
module. This image should be located in rootFolder/Images
38
40
5. Create your MS Form:
39
41
a. Make a copy of the Faculty and the Student Template surveys
@@ -48,7 +50,7 @@ copy the form link to SetupAppLinks (see step 6).
48
50
d. Click "Share", Select "Anyone with a link", Select "View"
49
51
e. Copy the sway link to SetupAppLinks (see step 6).
50
52
6. Add the Survey and Sway link to Utilities/SurveyLinks using
51
- SetupAppLinks.m in InternalFiles/RequiredFunctions/StartUpFcn
53
+ SetupAppLinks.mlx in InternalFiles/RequiredFunctions/StartUpFcn
52
54
7. Save > Export to .m file and save the result as
53
55
Utilities/ProjectStartupApp.m
54
56
@@ -97,6 +99,9 @@ function saveSettings(isReviewed,numLoad)
97
99
98
100
% Code that executes after component creation
99
101
function startupFcn(app )
102
+
103
+ % Copy title
104
+ app.ReviewTitle.Text = app .WelcomeTitle .Text ;
100
105
101
106
% Switch tab to review if has not been reviewed yet
102
107
if isfile(fullfile(" Utilities" ," ProjectSettings.mat" ))
@@ -107,11 +112,14 @@ function startupFcn(app)
107
112
numLoad = 1 ; % Initialize counter
108
113
end
109
114
110
- % Switch tab for review
115
+ % Select tab to display
111
116
if ~isReviewed && numLoad > 2
112
117
isReviewed = true ;
113
- app.TabGroup.SelectedTab = app .TabReview ;
118
+ app.FeedBackGrid.Parent = app .StartUpAppUIFigure ;
119
+ else
120
+ app.WelcomeGrid.Parent = app .StartUpAppUIFigure ;
114
121
end
122
+ app.InitPosition = app .StartUpAppUIFigure .Position ;
115
123
116
124
% Save new settings
117
125
app .saveSettings(isReviewed ,numLoad )
@@ -132,7 +140,6 @@ function startupFcn(app)
132
140
websave(fullfile(" Utilities/SurveyLinks.mat" ),Answer .Body .Data .download_url );
133
141
catch
134
142
end
135
-
136
143
end
137
144
138
145
% Close request function: StartUpAppUIFigure
@@ -142,7 +149,7 @@ function StartUpAppUIFigureCloseRequest(app, event)
142
149
elseif event .Source == app .MainMenuButton
143
150
open MainMenu.mlx
144
151
elseif event .Source == app .FacultyButton
145
- open MainMenu.mlx
152
+ open MainMenu.mlx
146
153
elseif event .Source == app .StudentButton
147
154
open MainMenu.mlx
148
155
elseif event .Source == app .OtherButton
@@ -181,7 +188,8 @@ function OtherButtonPushed(app, event)
181
188
182
189
% Button pushed function: ReviewUsButton
183
190
function ReviewUsButtonPushed(app , event )
184
- app.TabGroup.SelectedTab = app .TabReview ;
191
+ app.WelcomeGrid.Parent = app .WelcomePanel ;
192
+ app.FeedBackGrid.Parent = app .StartUpAppUIFigure ;
185
193
end
186
194
187
195
% Button pushed function: READMEButton
@@ -201,111 +209,123 @@ function createComponents(app)
201
209
app.StartUpAppUIFigure.AutoResizeChildren = ' off' ;
202
210
app.StartUpAppUIFigure.Position = [100 100 276 430 ];
203
211
app.StartUpAppUIFigure.Name = ' StartUp App' ;
204
- app.StartUpAppUIFigure.Resize = ' off' ;
205
212
app.StartUpAppUIFigure.CloseRequestFcn = createCallbackFcn(app , @StartUpAppUIFigureCloseRequest , true );
206
213
207
- % Create TabGroup
208
- app.TabGroup = uitabgroup(app .StartUpAppUIFigure );
209
- app.TabGroup.AutoResizeChildren = ' off' ;
210
- app.TabGroup.Position = [1 1 276 460 ];
211
-
212
- % Create WelcomeTab
213
- app.WelcomeTab = uitab(app .TabGroup );
214
- app.WelcomeTab.AutoResizeChildren = ' off' ;
215
- app.WelcomeTab.Title = ' Tab' ;
214
+ % Create WelcomePanel
215
+ app.WelcomePanel = uipanel(app .StartUpAppUIFigure );
216
+ app.WelcomePanel.AutoResizeChildren = ' off' ;
217
+ app.WelcomePanel.Position = [-551 33 244 410 ];
216
218
217
- % Create WelcomeTitle
218
- app.WelcomeTitle = uilabel(app .WelcomeTab );
219
- app.WelcomeTitle.HorizontalAlignment = ' center' ;
220
- app.WelcomeTitle.VerticalAlignment = ' top' ;
221
- app.WelcomeTitle.WordWrap = ' on' ;
222
- app.WelcomeTitle.FontSize = 24 ;
223
- app.WelcomeTitle.FontWeight = ' bold' ;
224
- app.WelcomeTitle.Position = [2 349 274 70 ];
225
- app.WelcomeTitle.Text = ' Multivariable: Space and Functions' ;
219
+ % Create WelcomeGrid
220
+ app.WelcomeGrid = uigridlayout(app .WelcomePanel );
221
+ app.WelcomeGrid.ColumnWidth = {' 1x' , ' 8x' , ' 1x' };
222
+ app.WelcomeGrid.RowHeight = {' 2x' , ' 5x' , ' 1x' , ' 1x' , ' 1x' };
226
223
227
224
% Create MainMenuButton
228
- app.MainMenuButton = uibutton(app .WelcomeTab , ' push' );
225
+ app.MainMenuButton = uibutton(app .WelcomeGrid , ' push' );
229
226
app.MainMenuButton.ButtonPushedFcn = createCallbackFcn(app , @MainMenuButtonPushed , true );
230
227
app.MainMenuButton.FontSize = 18 ;
231
- app.MainMenuButton.Position = [59 96 161 35 ];
228
+ app.MainMenuButton.Layout.Row = 3 ;
229
+ app.MainMenuButton.Layout.Column = 2 ;
232
230
app.MainMenuButton.Text = ' Main Menu' ;
233
231
234
- % Create ReviewUsButton
235
- app.ReviewUsButton = uibutton(app .WelcomeTab , ' push' );
236
- app.ReviewUsButton.ButtonPushedFcn = createCallbackFcn(app , @ReviewUsButtonPushed , true );
237
- app.ReviewUsButton.FontSize = 18 ;
238
- app.ReviewUsButton.Position = [59 10 161 35 ];
239
- app.ReviewUsButton.Text = ' Review Us' ;
240
-
241
232
% Create READMEButton
242
- app.READMEButton = uibutton(app .WelcomeTab , ' push' );
233
+ app.READMEButton = uibutton(app .WelcomeGrid , ' push' );
243
234
app.READMEButton.ButtonPushedFcn = createCallbackFcn(app , @READMEButtonPushed , true );
244
235
app.READMEButton.FontSize = 18 ;
245
- app.READMEButton.Position = [59 53 161 35 ];
236
+ app.READMEButton.Layout.Row = 4 ;
237
+ app.READMEButton.Layout.Column = 2 ;
246
238
app.READMEButton.Text = ' README' ;
247
239
248
- % Create Image
249
- app.Image = uiimage(app .WelcomeTab );
250
- app.Image.Position = [16 141 245 209 ];
251
- app.Image.ImageSource = ' ShapesCard.png' ;
240
+ % Create ReviewUsButton
241
+ app.ReviewUsButton = uibutton(app .WelcomeGrid , ' push' );
242
+ app.ReviewUsButton.ButtonPushedFcn = createCallbackFcn(app , @ReviewUsButtonPushed , true );
243
+ app.ReviewUsButton.FontSize = 18 ;
244
+ app.ReviewUsButton.Layout.Row = 5 ;
245
+ app.ReviewUsButton.Layout.Column = 2 ;
246
+ app.ReviewUsButton.Text = ' Review Us' ;
252
247
253
- % Create TabReview
254
- app.TabReview = uitab (app .TabGroup );
255
- app.TabReview.AutoResizeChildren = ' off ' ;
256
- app.TabReview.Title = ' Tab2 ' ;
257
- app.TabReview.HandleVisibility = ' off ' ;
248
+ % Create CoverImage
249
+ app.CoverImage = uiimage (app .WelcomeGrid );
250
+ app.CoverImage.Layout.Row = 2 ;
251
+ app.CoverImage.Layout.Column = [ 1 3 ] ;
252
+ app.CoverImage.ImageSource = ' ShapesCard.png ' ;
258
253
259
- % Create ReviewText
260
- app.ReviewText = uilabel(app .TabReview );
261
- app.ReviewText.HorizontalAlignment = ' center' ;
262
- app.ReviewText.VerticalAlignment = ' top' ;
263
- app.ReviewText.WordWrap = ' on' ;
264
- app.ReviewText.FontSize = 18 ;
265
- app.ReviewText.Position = [16 243 245 69 ];
266
- app.ReviewText.Text = ' Please help us improve your experience by answering a few questions.' ;
254
+ % Create WelcomeTitle
255
+ app.WelcomeTitle = uilabel(app .WelcomeGrid );
256
+ app.WelcomeTitle.HorizontalAlignment = ' center' ;
257
+ app.WelcomeTitle.VerticalAlignment = ' top' ;
258
+ app.WelcomeTitle.WordWrap = ' on' ;
259
+ app.WelcomeTitle.FontSize = 22 ;
260
+ app.WelcomeTitle.FontWeight = ' bold' ;
261
+ app.WelcomeTitle.Layout.Row = 1 ;
262
+ app.WelcomeTitle.Layout.Column = [1 3 ];
263
+ app.WelcomeTitle.Text = ' Multivariable: Space and Functions' ;
267
264
268
- % Create ReviewTitle
269
- app.ReviewTitle = uilabel (app .TabReview );
270
- app.ReviewTitle.HorizontalAlignment = ' center ' ;
271
- app.ReviewTitle.VerticalAlignment = ' top ' ;
272
- app.ReviewTitle.WordWrap = ' on ' ;
273
- app.ReviewTitle.FontSize = 24 ;
274
- app.ReviewTitle.FontWeight = ' bold ' ;
275
- app.ReviewTitle.Position = [ 2 326 274 93 ] ;
276
- app.ReviewTitle.Text = ' Multivariable: Space and Functions ' ;
265
+ % Create FeedBackPanel
266
+ app.FeedBackPanel = uipanel (app .StartUpAppUIFigure );
267
+ app.FeedBackPanel.AutoResizeChildren = ' off ' ;
268
+ app.FeedBackPanel.Position = [- 291 33 236 409 ] ;
269
+
270
+ % Create FeedBackGrid
271
+ app.FeedBackGrid = uigridlayout( app . FeedBackPanel ) ;
272
+ app.FeedBackGrid.ColumnWidth = { ' 1x ' , ' 8x ' , ' 1x ' } ;
273
+ app.FeedBackGrid.RowHeight = { ' 2x ' , ' 3x ' , ' 2x ' , ' 1x ' , ' 1x ' , ' 1x ' } ;
277
274
278
275
% Create Q1
279
- app.Q1 = uilabel(app .TabReview );
276
+ app.Q1 = uilabel(app .FeedBackGrid );
280
277
app.Q1.HorizontalAlignment = ' center' ;
281
- app.Q1.VerticalAlignment = ' top' ;
282
278
app.Q1.WordWrap = ' on' ;
283
279
app.Q1.FontSize = 18 ;
284
280
app.Q1.FontWeight = ' bold' ;
285
- app.Q1.Position = [16 141 245 69 ];
281
+ app.Q1.Layout.Row = 3 ;
282
+ app.Q1.Layout.Column = [1 3 ];
286
283
app.Q1.Text = ' What describes you best?' ;
287
284
288
285
% Create FacultyButton
289
- app.FacultyButton = uibutton(app .TabReview , ' push' );
286
+ app.FacultyButton = uibutton(app .FeedBackGrid , ' push' );
290
287
app.FacultyButton.ButtonPushedFcn = createCallbackFcn(app , @FacultyButtonPushed , true );
291
288
app.FacultyButton.FontSize = 18 ;
292
- app.FacultyButton.Position = [64 127 150 40 ];
289
+ app.FacultyButton.Layout.Row = 4 ;
290
+ app.FacultyButton.Layout.Column = 2 ;
293
291
app.FacultyButton.Text = ' Faculty' ;
294
292
295
293
% Create StudentButton
296
- app.StudentButton = uibutton(app .TabReview , ' push' );
294
+ app.StudentButton = uibutton(app .FeedBackGrid , ' push' );
297
295
app.StudentButton.ButtonPushedFcn = createCallbackFcn(app , @StudentButtonPushed , true );
298
296
app.StudentButton.FontSize = 18 ;
299
- app.StudentButton.Position = [64 80 150 40 ];
297
+ app.StudentButton.Layout.Row = 5 ;
298
+ app.StudentButton.Layout.Column = 2 ;
300
299
app.StudentButton.Text = ' Student' ;
301
300
302
301
% Create OtherButton
303
- app.OtherButton = uibutton(app .TabReview , ' push' );
302
+ app.OtherButton = uibutton(app .FeedBackGrid , ' push' );
304
303
app.OtherButton.ButtonPushedFcn = createCallbackFcn(app , @OtherButtonPushed , true );
305
304
app.OtherButton.FontSize = 18 ;
306
- app.OtherButton.Position = [64 34 150 40 ];
305
+ app.OtherButton.Layout.Row = 6 ;
306
+ app.OtherButton.Layout.Column = 2 ;
307
307
app.OtherButton.Text = ' Other' ;
308
308
309
+ % Create ReviewText
310
+ app.ReviewText = uilabel(app .FeedBackGrid );
311
+ app.ReviewText.HorizontalAlignment = ' center' ;
312
+ app.ReviewText.WordWrap = ' on' ;
313
+ app.ReviewText.FontSize = 14 ;
314
+ app.ReviewText.Layout.Row = 2 ;
315
+ app.ReviewText.Layout.Column = [1 3 ];
316
+ app.ReviewText.Text = ' Please help us improve your experience by answering a few questions.' ;
317
+
318
+ % Create ReviewTitle
319
+ app.ReviewTitle = uilabel(app .FeedBackGrid );
320
+ app.ReviewTitle.HorizontalAlignment = ' center' ;
321
+ app.ReviewTitle.VerticalAlignment = ' top' ;
322
+ app.ReviewTitle.WordWrap = ' on' ;
323
+ app.ReviewTitle.FontSize = 24 ;
324
+ app.ReviewTitle.FontWeight = ' bold' ;
325
+ app.ReviewTitle.Layout.Row = 1 ;
326
+ app.ReviewTitle.Layout.Column = [1 3 ];
327
+ app.ReviewTitle.Text = ' ' ;
328
+
309
329
% Show the figure after all components are created
310
330
app.StartUpAppUIFigure.Visible = ' on' ;
311
331
end
0 commit comments