Skip to content

Commit 1507331

Browse files
committed
bugfix to ButtonGrid to pass unit tests in vertical vs horizontal mode
1 parent f3e78a0 commit 1507331

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

widgets/+wt/ButtonGrid.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,22 @@ function update(obj)
152152
if obj.Orientation == "vertical"
153153
obj.Button(idx).Layout.Column = 1;
154154
obj.Button(idx).Layout.Row = idx;
155-
obj.Grid.ColumnWidth{idx} = obj.DefaultSize;
156155
else
157156
obj.Button(idx).Layout.Column = idx;
158157
obj.Button(idx).Layout.Row = 1;
159-
obj.Grid.ColumnWidth{idx} = obj.DefaultSize;
160158
end %if obj.Orientation == "vertical"
161159

162160
end %for idx = 1:numNew
163161

162+
% Update layout
163+
if obj.Orientation == "vertical"
164+
obj.Grid.ColumnWidth = {obj.DefaultSize};
165+
obj.Grid.RowHeight = repmat({obj.DefaultSize},1,numNew);
166+
else
167+
obj.Grid.ColumnWidth = repmat({obj.DefaultSize},1,numNew);
168+
obj.Grid.RowHeight = {obj.DefaultSize};
169+
end %if obj.Orientation == "vertical"
170+
164171
end %function
165172

166173

0 commit comments

Comments
 (0)