33 % Properties that correspond to app components
44 properties (Access = public )
55 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
1410 OtherButton matlab.ui.control.Button
1511 StudentButton matlab.ui.control.Button
1612 FacultyButton matlab.ui.control.Button
1713 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
2021 end
2122
2223
2324 properties (Access = private )
2425 GitHubOrganization = " MathWorks-Teaching-Resources" ; % Description
2526 GitHubRepository = " Multivariable-Space-and-Functions" ;
27+ InitPosition ;
2628 end
2729%% How to customize the app?
2830%{
3335 1. Change "Module Template" in app.WelcomeTitle by your module name
3436 2. Change "Module Template" in app.ReviewTitle by your module name
3537 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
3739 module. This image should be located in rootFolder/Images
3840 5. Create your MS Form:
3941 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).
4850 d. Click "Share", Select "Anyone with a link", Select "View"
4951 e. Copy the sway link to SetupAppLinks (see step 6).
5052 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
5254 7. Save > Export to .m file and save the result as
5355 Utilities/ProjectStartupApp.m
5456
@@ -97,6 +99,9 @@ function saveSettings(isReviewed,numLoad)
9799
98100 % Code that executes after component creation
99101 function startupFcn(app )
102+
103+ % Copy title
104+ app.ReviewTitle.Text = app .WelcomeTitle .Text ;
100105
101106 % Switch tab to review if has not been reviewed yet
102107 if isfile(fullfile(" Utilities" ," ProjectSettings.mat" ))
@@ -107,11 +112,14 @@ function startupFcn(app)
107112 numLoad = 1 ; % Initialize counter
108113 end
109114
110- % Switch tab for review
115+ % Select tab to display
111116 if ~isReviewed && numLoad > 2
112117 isReviewed = true ;
113- app.TabGroup.SelectedTab = app .TabReview ;
118+ app.FeedBackGrid.Parent = app .StartUpAppUIFigure ;
119+ else
120+ app.WelcomeGrid.Parent = app .StartUpAppUIFigure ;
114121 end
122+ app.InitPosition = app .StartUpAppUIFigure .Position ;
115123
116124 % Save new settings
117125 app .saveSettings(isReviewed ,numLoad )
@@ -132,7 +140,6 @@ function startupFcn(app)
132140 websave(fullfile(" Utilities/SurveyLinks.mat" ),Answer .Body .Data .download_url );
133141 catch
134142 end
135-
136143 end
137144
138145 % Close request function: StartUpAppUIFigure
@@ -142,7 +149,7 @@ function StartUpAppUIFigureCloseRequest(app, event)
142149 elseif event .Source == app .MainMenuButton
143150 open MainMenu.mlx
144151 elseif event .Source == app .FacultyButton
145- open MainMenu.mlx
152+ open MainMenu.mlx
146153 elseif event .Source == app .StudentButton
147154 open MainMenu.mlx
148155 elseif event .Source == app .OtherButton
@@ -181,7 +188,8 @@ function OtherButtonPushed(app, event)
181188
182189 % Button pushed function: ReviewUsButton
183190 function ReviewUsButtonPushed(app , event )
184- app.TabGroup.SelectedTab = app .TabReview ;
191+ app.WelcomeGrid.Parent = app .WelcomePanel ;
192+ app.FeedBackGrid.Parent = app .StartUpAppUIFigure ;
185193 end
186194
187195 % Button pushed function: READMEButton
@@ -201,111 +209,123 @@ function createComponents(app)
201209 app.StartUpAppUIFigure.AutoResizeChildren = ' off' ;
202210 app.StartUpAppUIFigure.Position = [100 100 276 430 ];
203211 app.StartUpAppUIFigure.Name = ' StartUp App' ;
204- app.StartUpAppUIFigure.Resize = ' off' ;
205212 app.StartUpAppUIFigure.CloseRequestFcn = createCallbackFcn(app , @StartUpAppUIFigureCloseRequest , true );
206213
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 ];
216218
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' };
226223
227224 % Create MainMenuButton
228- app.MainMenuButton = uibutton(app .WelcomeTab , ' push' );
225+ app.MainMenuButton = uibutton(app .WelcomeGrid , ' push' );
229226 app.MainMenuButton.ButtonPushedFcn = createCallbackFcn(app , @MainMenuButtonPushed , true );
230227 app.MainMenuButton.FontSize = 18 ;
231- app.MainMenuButton.Position = [59 96 161 35 ];
228+ app.MainMenuButton.Layout.Row = 3 ;
229+ app.MainMenuButton.Layout.Column = 2 ;
232230 app.MainMenuButton.Text = ' Main Menu' ;
233231
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-
241232 % Create READMEButton
242- app.READMEButton = uibutton(app .WelcomeTab , ' push' );
233+ app.READMEButton = uibutton(app .WelcomeGrid , ' push' );
243234 app.READMEButton.ButtonPushedFcn = createCallbackFcn(app , @READMEButtonPushed , true );
244235 app.READMEButton.FontSize = 18 ;
245- app.READMEButton.Position = [59 53 161 35 ];
236+ app.READMEButton.Layout.Row = 4 ;
237+ app.READMEButton.Layout.Column = 2 ;
246238 app.READMEButton.Text = ' README' ;
247239
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' ;
252247
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 ' ;
258253
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' ;
267264
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 ' } ;
277274
278275 % Create Q1
279- app.Q1 = uilabel(app .TabReview );
276+ app.Q1 = uilabel(app .FeedBackGrid );
280277 app.Q1.HorizontalAlignment = ' center' ;
281- app.Q1.VerticalAlignment = ' top' ;
282278 app.Q1.WordWrap = ' on' ;
283279 app.Q1.FontSize = 18 ;
284280 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 ];
286283 app.Q1.Text = ' What describes you best?' ;
287284
288285 % Create FacultyButton
289- app.FacultyButton = uibutton(app .TabReview , ' push' );
286+ app.FacultyButton = uibutton(app .FeedBackGrid , ' push' );
290287 app.FacultyButton.ButtonPushedFcn = createCallbackFcn(app , @FacultyButtonPushed , true );
291288 app.FacultyButton.FontSize = 18 ;
292- app.FacultyButton.Position = [64 127 150 40 ];
289+ app.FacultyButton.Layout.Row = 4 ;
290+ app.FacultyButton.Layout.Column = 2 ;
293291 app.FacultyButton.Text = ' Faculty' ;
294292
295293 % Create StudentButton
296- app.StudentButton = uibutton(app .TabReview , ' push' );
294+ app.StudentButton = uibutton(app .FeedBackGrid , ' push' );
297295 app.StudentButton.ButtonPushedFcn = createCallbackFcn(app , @StudentButtonPushed , true );
298296 app.StudentButton.FontSize = 18 ;
299- app.StudentButton.Position = [64 80 150 40 ];
297+ app.StudentButton.Layout.Row = 5 ;
298+ app.StudentButton.Layout.Column = 2 ;
300299 app.StudentButton.Text = ' Student' ;
301300
302301 % Create OtherButton
303- app.OtherButton = uibutton(app .TabReview , ' push' );
302+ app.OtherButton = uibutton(app .FeedBackGrid , ' push' );
304303 app.OtherButton.ButtonPushedFcn = createCallbackFcn(app , @OtherButtonPushed , true );
305304 app.OtherButton.FontSize = 18 ;
306- app.OtherButton.Position = [64 34 150 40 ];
305+ app.OtherButton.Layout.Row = 6 ;
306+ app.OtherButton.Layout.Column = 2 ;
307307 app.OtherButton.Text = ' Other' ;
308308
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+
309329 % Show the figure after all components are created
310330 app.StartUpAppUIFigure.Visible = ' on' ;
311331 end
0 commit comments