Announcement

Collapse
No announcement yet.

Tooltips for own-drawn controls

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tooltips for own-drawn controls

    Folks --
    I want to display tool tips for own-drawn (in WM_PAINT) elements.
    I imagine how to do this by creating special class.
    But probably exist more simple way, API similar DrawCaption, DrawFrameControl ?

  • #2
    Semen;

    I am not sure what you are asking for.

    Are you trying to create your own custom Tooltips ?

    Normal Tooltips controls should work for "any" type of control. They actually subclass themselves to any control they are attached to and work automatically, so why create your own ?



    ------------------
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      Semen --

      This is a cut and paste from WinLIFT

      Code:
      'Creates a tooltip
      FUNCTION skTooltip&(BYVAL hOwner&, BYVAL hObj&, BYVAL Text$) EXPORT
      '@'skdebug "93"
      
          STATIC htt&
          LOCAL ti AS TOOLINFO
          LOCAL zLabel AS ASCIIZ * 256
      
          zLabel = Text$
          IF htt& = 0 THEN
             CALL InitCommonControls()
             htt& = CreateWindowEx(0, _
                                   "tooltips_class32", _
                                   BYVAL %NULL, _
                                   %WS_POPUP OR %TTS_ALWAYSTIP, _
                                   %CW_USEDEFAULT, _
                                   %CW_USEDEFAULT, _
                                   %CW_USEDEFAULT, _
                                   %CW_USEDEFAULT, _
                                   BYVAL hOwner&, _
                                   BYVAL %NULL, _
                                   GetWindowLong(hOwner&, %GWL_HINSTANCE), _ 'hinst
                                   BYVAL %NULL)
          END IF
          IF htt& THEN
             ti.cbsize = sizeof(ti)
             ti.uFlags = %TTF_IDISHWND OR %TTF_SUBCLASS
             ti.hwnd = hOwner&
             ti.uId = hObj&
             ti.lpszText = VARPTR(zLabel)
      
         '   ti.hinst = hInst&
         '   call SetRect(rc, 230, 179, 230+39, 179+31)
         '   ti.rect = rc
            'ti.rect.left = col * CX_COLUMN;
            'ti.rect.top = row * CY_ROW;
            'ti.rect.right = ti.rect.left + CX_COLUMN;
            'ti.rect.bottom = ti.rect.top + CY_ROW
      
             CALL SendMessage(htt&, %TTM_ADDTOOL, 0, VARPTR(ti))
          END IF
          FUNCTION = htt&
      END FUNCTION

      ------------------
      Patrice Terrier
      mailto[email protected][email protected]</A>
      Patrice Terrier
      www.zapsolution.com
      www.objreader.com
      Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

      Comment


      • #4
        Chris & Patrice --
        I draw some "controls" and using mousemove is able to detect a moment, when cursor is over this "control".
        hWnd has only "parent".
        Just now I will try to analyze suggestion about subclassing.
        Thanks.


        ------------------




        [This message has been edited by Semen Matusovski (edited June 10, 2000).]

        Comment

        Working...
        X