|
6 | 6 | UITable matlab.ui.control.Table |
7 | 7 | Button matlab.ui.control.Button |
8 | 8 | end |
| 9 | + |
| 10 | + properties (Access = private, Constant = true) |
| 11 | + ID_ATTRIBUTE_NAME = 'id'; |
| 12 | + end |
9 | 13 |
|
10 | 14 | methods (Access = private) |
11 | 15 |
|
12 | 16 | % Button pushed function: Button |
13 | 17 | function ButtonPushed(app, ~) |
14 | | - % Return all registered widgets: |
| 18 | + IAN = app.ID_ATTRIBUTE_NAME; |
| 19 | + hWin = mlapptools.getWebWindow(app.UIFigure); |
| 20 | + % Return all registered widgets: |
15 | 21 | [~,w] = mlapptools.getWidgetList(app.UIFigure); |
16 | 22 | % Filter list: |
17 | 23 | w = w(~cellfun(@isempty,w.id) & ... |
18 | 24 | cellfun(@(x)~isempty(strfind(x,'uniq')),w.id),:); %#ok<STREMP> |
19 | 25 | % Apply random styles: |
20 | 26 | for ind1 = 1:4:size(w,1) |
21 | 27 | mlapptools.setStyle(... |
22 | | - app.UIFigure,... |
| 28 | + hWin,... |
23 | 29 | 'border',... |
24 | 30 | '2px solid red',... |
25 | | - w{ind1,'id'}{1}); |
| 31 | + struct('ID_attr',IAN,'ID_val',w{ind1,IAN}{1})); |
26 | 32 | end |
27 | 33 |
|
28 | 34 | for ind2 = 2:4:size(w,1) |
29 | 35 | mlapptools.setStyle(... |
30 | | - app.UIFigure,... |
| 36 | + hWin,... |
31 | 37 | 'background-image',... |
32 | 38 | 'url(http://lorempixel.com/40/120/)',... |
33 | | - w{ind2,'id'}{1}); |
| 39 | + struct('ID_attr',IAN,'ID_val',w{ind2,IAN}{1})); |
34 | 40 | end |
35 | 41 |
|
36 | 42 | for ind3 = 3:4:size(w,1) |
37 | 43 | mlapptools.setStyle(... |
38 | | - app.UIFigure,... |
| 44 | + hWin,... |
39 | 45 | 'background-color',... |
40 | 46 | ['rgb(' num2str(randi(255)) ',' num2str(randi(255)) ',' ... |
41 | 47 | num2str(randi(255)) +')'],... |
42 | | - w{ind3,'id'}{1}); |
| 48 | + struct('ID_attr',IAN,'ID_val',w{ind3,IAN}{1})); |
43 | 49 | end |
44 | 50 |
|
45 | 51 | for ind4 = 4:4:size(w,1) |
46 | 52 | mlapptools.setStyle(... |
47 | | - app.UIFigure,... |
| 53 | + hWin,... |
48 | 54 | 'padding',... |
49 | 55 | '0cm 1cm 0cm 0cm',... |
50 | | - w{ind4,'id'}{1}); |
| 56 | + struct('ID_attr',IAN,'ID_val',w{ind4,IAN}{1})); |
51 | 57 | end |
52 | 58 |
|
53 | 59 | end |
|
0 commit comments