tooltiptoggle

by

 

22 Jan 2008 (Updated )

Toggle display of tooltips within given figure handle

tooltiptoggle(figH)
function tooltiptoggle(figH)
    %TOOLTIPTOGGLE Toggle display of tool tips in GUI
    %   TOOLTIPTOOGLE takes a figure handle as input and toggles the display
    %   of tool within its child components.
    %
    %   TOOLTIPTOGGLE(H) toggles the display of tooltip string in the GUI
    %   components inside figure handle H

    %check if it has a toggle status
    if(isempty(getappdata(figH,'tts_toggle_status')))
        setappdata(figH,'tts_toggle_status',1);
    end


    if(getappdata(figH,'tts_toggle_status')==1)

        cfigH=findobj(figH,'-regexp','ToolTipString','.*');
        setappdata(figH,'tooltipObjectH',cfigH);

        for hIndx=1:length(cfigH)

            try
                ttps=get(cfigH(hIndx),'ToolTipString');
                setappdata(cfigH(hIndx),'tts_saved',ttps);
                set(cfigH(hIndx),'ToolTipString','');
            catch
                continue;
            end

        end
        setappdata(figH,'tts_toggle_status',0);
    else
        cfigH=getappdata(figH,'tooltipObjectH');

        for hIndx=1:length(cfigH)

            try
                ttps=getappdata(cfigH(hIndx),'tts_saved');
                set(cfigH(hIndx),'ToolTipString',ttps);
            catch
                continue;
            end

        end
        setappdata(figH,'tts_toggle_status',1);

    end

Contact us