TooltipString won't show if uicontrol Enable is not 'on'
12 views (last 30 days)
Hey MATLAB users,
I have a Edit style uicontrol label, which has set 'enable' to 'intactive' to make it not editable.
But now, I also want to add a tooltipString for this ui label, but since it's set to inactive, nothing will show.
I really dont want to use 'text' since there is no outline for the label box.
Is there anyway I could add TooltipString for this case.
there is one ticket about it, but didn't solve my question really well: https://www.mathworks.com/matlabcentral/answers/81029-tooltipstring-not-displaying-when-button-is-disabled
Luna on 24 Jan 2019
Edited: Luna on 24 Jan 2019
Here you can get the object, set editable property of the Java object as false like below and then add a tooltip.
hEditbox = uicontrol('String','Edit Text','Style','edit');
jEditbox = findjobj(hEditbox); % gets the java object handle
set(jEditbox,'Editable',false); % this will disable your editbox
set(jEditbox,'ToolTipText','Text is inactive for a reason'); % this will create a tooltip string