Undocumented Secrets of MATLAB
®
-Java Programming428
A demonstration of this appears below with some comments following (note that this code
uses the FindJObj utility — see Section 7.2):
% Illustrates how to make a tooltip appear on an inactive control
function inactiveBtnToolTip
h = figure('WindowButtonMotionFcn',@motionFcn);
col = get(h,'color');
lbl = uicontrol('Style','text', 'Pos',[10,160,120,20], . . .
'Background',col, 'HorizontalAlignment','left');
btn = uicontrol('Parent',h, 'String','Button', . . .
'Enable','inactive', 'Pos',[10,40,60,20]);
uicontrol('Style','check', 'Parent',h, . . .
'String','Enable button tooltip', . . .
'Callback',@chkTooltipEnable, 'Value',1, . . .
'Pos',[10,80,180,20], 'Background',col);
% Create the tooltip and ...