Announcement

Collapse
No announcement yet.

Tooltips for own-drawn controls

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

  • Semen Matusovski
    replied
    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).]

    Leave a comment:


  • Patrice Terrier
    replied
    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>

    Leave a comment:


  • Chris Boss
    replied
    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 ?



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

    Leave a comment:


  • Semen Matusovski
    started a topic Tooltips for own-drawn controls

    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 ?
Working...
X