    'ToolTips.inc
    'https://docs.microsoft.com/de-de/windows/desktop/Controls/tooltip-control-reference
     
    'uses corewin
     
    ' tooltips constants 
    % TTF_IDISHWND=1
    % TTF_CENTERTIP=2
    % TTF_SUBCLASS=16
    % TTI_NONE  0
    % TTI_INFO  1
    % TTI_WARNING  2
    % TTI_ERROR  3
    % TTI_INFO_LARGE  4
    % TTI_WARNING_LARGE  5
    % TTI_ERROR_LARGE  6
    % TTM_ADDTOOL=1028
    % TTM_DELTOOL=1029
    % TTM_SETTIPBKCOLOR=1043
    % TTM_SETTIPTEXTCOLOR=1044
    % TTM_SETMAXTIPWIDTH=1048
    % TTM_SETTITLE=1056
    % TTS_ALWAYSTIP=1
    % TTS_BALLOON=64
     
    type TOOLINFO
      UINT      cbSize
      UINT      uFlags
      sys       hwnd
      sys       uId    'UINT_PTR
      RECT      rect   'must be checked
      sys       hinst
      char*     lpszText
      sys       lParam
      sys      *lpReserved
    end type
     
    '============================
    ' RGB function for O2
    function RGB(int rcc, gcc, bcc) as int
       return (rcc + gcc*256 + bcc*65536)
    end Function 
    '=======================================
     
    function SetToolTip(sys hwnd, string TipText, optional bool Balloon=false, bCentered=false) as sys
     
        TOOLINFO TI
        sys flags=TTS_ALWAYSTIP
        uint uFlags=TTF_SUBCLASS or TTF_IDISHWND
     
        if Balloon then flags=flags or TTS_BALLOON
        if bCentered then uflags=uflags or TTF_CENTERTIP
     
        sys hToolTip = CreateWindowEx(0, "tooltips_class32", "", flags,
                                      0, 0, 0, 0, hwnd, null, GetModuleHandle(null), null)
     
        TI.cbSize    = sizeof(TI)
        TI.uFlags    = uflags
        TI.hWnd      = GetParent(hToolTip)
        TI.uId       = hwnd
        TI.lpszText  = strptr TipText
        SendMessage (hToolTip, TTM_ADDTOOL, 0, &ti)
     
         return hToolTip
    end function
     
    'set the text color
    sub setTooltipTextColor(sys hTool, int FGcolor)
        SendMessage (hTool, TTM_SETTIPTEXTCOLOR, FGcolor, 0)
    end sub
     
    'for the background color
    sub setTooltipBackColor(sys hTool, int BKcolor)
        SendMessage (hTool, TTM_SETTIPBKCOLOR, BKcolor)
    end sub
     
    'set a title for the tooltip
    sub setTooltipTitle(sys hTool, string Text, optional sys icon=TTI_INFO)
       SendMessage(hTool, TTM_SETTITLE, icon, Text)
    end sub
     
    'limit Tooltip max width
    sub setTooltipWidth(sys hTool, int maxwidth) 
       SendMessage(hTool, TTM_SETMAXTIPWIDTH, 0, maxwidth)
    end sub      
