3535 % Indicates whether to allow sort controls
3636 Sortable (1 ,1 ) matlab.lang.OnOffSwitchState = true
3737
38+ % Width of the buttons
39+ ButtonWidth = 25
40+
41+ % Height of the buttons
42+ ButtonHeight = 25
43+
3844 end % properties
3945
4046
6672 end % properties
6773
6874
69- properties (AbortSet , Dependent , UsedInUpdate = false )
70-
71- % Width of the buttons
72- ButtonWidth
73-
74- end % properties
75-
76-
7775
7876 %% Read-Only properties
7977 properties (SetAccess = private )
@@ -117,14 +115,14 @@ function setup(obj)
117115
118116 % Configure grid
119117 obj.Grid.Padding = 3 ;
120- obj.Grid.ColumnWidth = {' 1x' ,28 ,' 1x' };
121- obj.Grid.RowHeight = {' fit' ,' 1x' };
118+ obj.Grid.ColumnWidth = {' 1x' ,' fit ' ,' 1x' };
119+ obj.Grid.RowHeight = {' fit' ,' fit ' , ' 1x' };
122120
123121 % Create the left Listbox
124122 obj.LeftList = uilistbox(obj .Grid );
125123 obj.LeftList.Multiselect = true ;
126124 obj.LeftList.Layout.Column = 1 ;
127- obj.LeftList.Layout.Row = [1 2 ];
125+ obj.LeftList.Layout.Row = [1 3 ];
128126 obj.LeftList.ValueChangedFcn = @(h ,e )obj .onLeftSelectionChanged(e );
129127
130128 % Create the list buttons
@@ -143,7 +141,7 @@ function setup(obj)
143141 obj.RightList = uilistbox(obj .Grid );
144142 obj.RightList.Multiselect = true ;
145143 obj.RightList.Layout.Column = 3 ;
146- obj.RightList.Layout.Row = [1 2 ];
144+ obj.RightList.Layout.Row = [1 3 ];
147145 obj.RightList.ValueChangedFcn = @(h ,e )obj .onRightSelectionChanged(e );
148146
149147 % Update listeners
@@ -187,13 +185,17 @@ function update(obj)
187185 if obj .Sortable
188186 obj.ListButtons.Icon = [" right_24.png" , " left_24.png" , " up_24.png" , " down_24.png" ];
189187 obj.ListButtons.ButtonTag = [" Add" , " Remove" , " Up" , " Down" ];
190- obj.ListButtons.ButtonHeight = {28 28 28 28 };
191188 else
192189 obj.ListButtons.Icon = [" right_24.png" , " left_24.png" ];
193190 obj.ListButtons.ButtonTag = [" Add" , " Remove" ];
194- obj.ListButtons.ButtonHeight = {28 28 };
195191 end
196192
193+ % Button width and height
194+ obj.UserButtons.ButtonWidth = obj .ButtonWidth ;
195+ obj.ListButtons.ButtonWidth = obj .ButtonWidth ;
196+ obj.UserButtons.ButtonHeight = obj .ButtonHeight ;
197+ obj.ListButtons.ButtonHeight = obj .ButtonHeight ;
198+
197199 % Update button enable states
198200 obj .updateEnables();
199201
@@ -594,13 +596,6 @@ function shiftListBoxIndex(obj, shift)
594596 end
595597 end
596598
597- function value = get .ButtonWidth(obj )
598- value = obj.Grid.ColumnWidth{2 };
599- end
600- function set .ButtonWidth(obj ,value )
601- obj.Grid.ColumnWidth{2 } = value ;
602- end
603-
604599 end % methods
605600
606601end % classdef
0 commit comments