Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions Demo/TableDemo.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,54 @@
UITable matlab.ui.control.Table
Button matlab.ui.control.Button
end

properties (Access = private, Constant = true)
ID_ATTRIBUTE_NAME = 'id';
end

methods (Access = private)

% Button pushed function: Button
function ButtonPushed(app, ~)
% Return all registered widgets:
IAN = app.ID_ATTRIBUTE_NAME;
hWin = mlapptools.getWebWindow(app.UIFigure);
% Return all registered widgets:
[~,w] = mlapptools.getWidgetList(app.UIFigure);
% Filter list:
w = w(~cellfun(@isempty,w.id) & ...
cellfun(@(x)~isempty(strfind(x,'uniq')),w.id),:); %#ok<STREMP>
% Apply random styles:
for ind1 = 1:4:size(w,1)
mlapptools.setStyle(...
app.UIFigure,...
hWin,...
'border',...
'2px solid red',...
w{ind1,'id'}{1});
struct('ID_attr',IAN,'ID_val',w{ind1,IAN}{1}));
end

for ind2 = 2:4:size(w,1)
mlapptools.setStyle(...
app.UIFigure,...
hWin,...
'background-image',...
'url(http://lorempixel.com/40/120/)',...
w{ind2,'id'}{1});
struct('ID_attr',IAN,'ID_val',w{ind2,IAN}{1}));
end

for ind3 = 3:4:size(w,1)
mlapptools.setStyle(...
app.UIFigure,...
hWin,...
'background-color',...
['rgb(' num2str(randi(255)) ',' num2str(randi(255)) ',' ...
num2str(randi(255)) +')'],...
w{ind3,'id'}{1});
struct('ID_attr',IAN,'ID_val',w{ind3,IAN}{1}));
end

for ind4 = 4:4:size(w,1)
mlapptools.setStyle(...
app.UIFigure,...
hWin,...
'padding',...
'0cm 1cm 0cm 0cm',...
w{ind4,'id'}{1});
struct('ID_attr',IAN,'ID_val',w{ind4,IAN}{1}));
end

end
Expand Down
Loading