Skip to content

Commit c8f0964

Browse files
authored
Merge pull request #118 from mathworks/116-baseapp-changes-to-varargin-and-preferences-handling-fail-to-support-subclass-property-value-pairs
116 baseapp changes to varargin and preferences handling fail to support subclass property value pairs
2 parents 0b3b894 + 66de3e7 commit c8f0964

File tree

12 files changed

+242
-26
lines changed

12 files changed

+242
-26
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="BaseAppSubclassWithPrefs.m" type="File"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="+model" type="File"/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="CustomPreferenceForTest.m" type="File"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="1" type="DIR_SIGNIFIER"/>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
classdef BaseAppSubclassWithPrefs < wt.apps.BaseApp
2+
% Test app utilizing the BaseApp subclass
3+
% Copyright 2025 The MathWorks Inc.
4+
5+
%% Properties
6+
properties (AbortSet)
7+
8+
% Name of the app
9+
PropertyA (1,1) double = 10
10+
11+
end %properties
12+
13+
14+
%% Constructor / destructor
15+
methods (Access = public)
16+
17+
function app = BaseAppSubclassWithPrefs(varargin)
18+
% Constructor
19+
20+
% Custom preferences
21+
prefs = wt.test.model.CustomPreferenceForTest();
22+
prefGroup = "wtTemporaryPreferenceGroup";
23+
24+
% Call the superclass constructor with custom prefs
25+
26+
"PreferenceGroup",prefGroup,...
27+
"Preferences",prefs,...
28+
varargin{:});
29+
30+
end %methods
31+
32+
end %function
33+
34+
35+
%% Internal Properties
36+
properties (Hidden, SetAccess = private)
37+
38+
% Label
39+
Label matlab.ui.control.Label
40+
41+
EditField matlab.ui.control.NumericEditField
42+
43+
end %properties
44+
45+
46+
%% Protectected Methods
47+
methods (Access = protected)
48+
49+
function setup(app)
50+
51+
% Create a label in the grid
52+
app.Label = uilabel(app.Grid);
53+
app.Label.HorizontalAlignment = "center";
54+
app.Label.VerticalAlignment = "center";
55+
app.Label.FontSize = 24;
56+
app.Label.Text = "Test App - setup";
57+
58+
% Create a label in the grid
59+
app.EditField = uieditfield(app.Grid,'numeric');
60+
app.EditField.FontSize = 24;
61+
62+
end %function
63+
64+
65+
function update(app)
66+
67+
app.Label.Text = "Text App - update";
68+
app.EditField.Value = app.PropertyA;
69+
70+
end %function
71+
72+
end %methods
73+
74+
end %classdef
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
classdef CustomPreferenceForTest < wt.model.Preferences
2+
% Example subclassed preferences for unit testing
3+
4+
% Copyright 2025 The MathWorks Inc.
5+
6+
7+
%% Preference Properties
8+
properties (AbortSet)
9+
10+
% Starting window position
11+
TestPreferenceA (1,1) double = 17
12+
13+
end %properties
14+
15+
end %classdef

0 commit comments

Comments
 (0)