Skip to content

Commit fe7b781

Browse files
committed
add ItemsTooltip, BackTooltip, ForwardTooltip to TaskStatusTable
1 parent 5546685 commit fe7b781

File tree

1 file changed

+40
-14
lines changed

1 file changed

+40
-14
lines changed

widgets/+wt/TaskStatusTable.m

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
Items (:,1) string = ["Step 1","Step 2","Step 3","Step 4",...
1818
"Step 5","Step 6","Step 7"]
1919

20+
% Tooltip of each task
21+
ItemsTooltip (:,1) string
22+
2023
% Status of task
2124
Status (:,1) wt.enum.StatusState = [
2225
wt.enum.StatusState.complete
@@ -45,6 +48,12 @@
4548

4649
% Enables the task back button to proceed
4750
EnableBack (1,1) matlab.lang.OnOffSwitchState = true
51+
52+
% Tooltip for back button
53+
BackTooltip (1,1) string = ""
54+
55+
% Tooltip for forward button
56+
ForwardTooltip (1,1) string = ""
4857

4958
end %properties
5059

@@ -139,6 +148,7 @@ function setup(obj)
139148
% Update the internal component lists
140149
obj.BackgroundColorableComponents = [obj.TaskGrid obj.Grid];
141150
obj.ButtonColorableComponents = [obj.BackButton, obj.ForwardButton];
151+
obj.TooltipableComponents = [obj.TaskGrid obj.Grid obj.StatusLabel];
142152

143153
end %function
144154

@@ -176,33 +186,45 @@ function update(obj)
176186
obj.EnableableComponents = [obj.Label, obj.Icon, obj.StatusLabel];
177187
end
178188

179-
% Update the task names and icons
189+
% Update the task names, tooltips, and icons
180190
status = obj.Status;
181191
imgFile = string(status) + "_16.png";
182192
imgFile(status=="running") = "running_16.gif";
183193
numImg = numel(obj.Icon);
194+
numTooltip = numel(obj.ItemsTooltip);
184195
for idx = 1:numNew
185-
wt.utility.fastSet(obj.Label(idx),"Text",obj.Items(idx));
186-
if idx <= numImg
187-
wt.utility.fastSet(obj.Icon(idx),"Visible","on");
188-
if obj.Icon(idx).ImageSource ~= imgFile(idx)
189-
if exist(imgFile(idx),'file')
190-
obj.Icon(idx).ImageSource = imgFile(idx);
191-
else
192-
obj.Icon(idx).ImageSource = "";
193-
end
194-
end
196+
197+
% Icon
198+
if idx <= numImg && exist(imgFile(idx),'file')
199+
thisVisible = "on";
200+
thisImage = imgFile(idx);
195201
else
196-
wt.utility.fastSet(obj.Icon(idx),"Visible","off");
202+
thisVisible = "off";
203+
thisImage = "";
197204
end
198-
end
205+
206+
% Tooltip
207+
if idx <= numTooltip
208+
thisTooltip = obj.ItemsTooltip(idx);
209+
else
210+
thisTooltip = obj.Tooltip;
211+
end
212+
213+
% Set label and icon properties
214+
wt.utility.fastSet(obj.Label(idx),"Text",obj.Items(idx));
215+
wt.utility.fastSet(obj.Label(idx),"Tooltip",thisTooltip);
216+
wt.utility.fastSet(obj.Icon(idx),"ImageSource",thisImage);
217+
wt.utility.fastSet(obj.Icon(idx),"Visible",thisVisible);
218+
219+
end %for
199220

200221
% Update row heights
201222
wt.utility.fastSet(obj.TaskGrid, "RowHeight", repmat({obj.RowHeight},1,numNew));
202223

203224
% Show/hide status and button row
204225
if obj.ShowButtonRow
205-
obj.Grid.RowHeight{2} = 25;
226+
obj.Grid.RowHeight{2} = obj.RowHeight;
227+
obj.Grid.ColumnWidth([1 3]) = {obj.RowHeight};
206228
else
207229
obj.Grid.RowHeight{2} = 0;
208230
end
@@ -222,6 +244,10 @@ function update(obj)
222244

223245
% Update the button enables
224246
obj.updateEnableableComponents();
247+
248+
% Update tooltips
249+
obj.ForwardButton.Tooltip = obj.ForwardTooltip;
250+
obj.BackButton.Tooltip = obj.BackTooltip;
225251

226252
end %function
227253

0 commit comments

Comments
 (0)