Announcement

Collapse
No announcement yet.

Multiple lines Tooltiptext?

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

  • Eddy Van Esch
    replied
    Thanks very much Lance!
    Kind regards
    Eddy


    ------------------
    [email protected]

    Leave a comment:


  • Lance Edmonds
    replied
    Yes, if you place the following line (into the code at the top of this thread) right after the CreateWindowEx() call, it works fine under Win2K. I've not tested onother platforms.
    Code:
         DIALOG SEND hWnd_ToolTip, %TTM_SETMAXTIPWIDTH, 0, 200
    The last parameter is the width in Pixels, and it respects CHR$(13) for line breaks.

    See http://msdn.microsoft.com/library/de...axtipwidth.asp



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Eddy Van Esch
    replied
    I found this on the net. Haven't tested it yet...
    ' Send a message to the tool tip window telling it to set 'the maximum tip
    ' width, to allow line breaking.
    RetVal = SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, 80)

    Eddy

    ------------------
    [email protected]

    [This message has been edited by Eddy Van Esch (edited July 18, 2001).]

    Leave a comment:


  • Eddy Van Esch
    started a topic Multiple lines Tooltiptext?

    Multiple lines Tooltiptext?

    Hi all,
    Maybe a simple question: How can I create a tooltiptext that consists of multiple
    lines? I tried in the example below with a simple $CR (carriage return) but this does
    not work. $CRLF also does not work..
    Kind regards
    Eddy

    Code:
       #COMPILE EXE
       OPTION EXPLICIT
       #INCLUDE "win32api.inc"
       #INCLUDE "CommCtrl.Inc"
    
      GLOBAL ti AS TOOLINFO
      GLOBAL hDlg AS LONG
      GLOBAL hWnd_ToolTip AS LONG
    
      DECLARE SUB SetToolTipText(BYVAL id AS LONG, ttxt AS ASCIIZ * 50)
       FUNCTION PBMAIN
         DIM  i AS LONG
         InitCommonControls
         hWnd_ToolTip = CreateWindowEx( 0, "tooltips_class32", "", %TTS_ALWAYSTIP, 0, 0, 0, 0, 0, _
             BYVAL 0&, GetModuleHandle(BYVAL 0&), BYVAL 0&)
    
         DIALOG NEW 0, "Tooltip example",,, 400, 40, %WS_CAPTION OR %WS_SYSMENU TO hDlg
         CONTROL ADD BUTTON, hDlg, 101, "PROGRAM", 5,  5, 25, 25
         SetToolTipText 101, "This is a tooltip" & $CR & "Hoped this would be on another line.."
         CONTROL ADD BUTTON, hDlg, 102, "TOOLBAR", 45,  5, 350, 25
         SetToolTipText 102, "Another tooltip !"
    
         DIALOG SHOW MODAL hDlg
    END FUNCTION
    
    SUB SetToolTipText(BYVAL id AS LONG, ttxt AS ASCIIZ * 50)
         ti.cbSize   = LEN(ti)
         ti.uFlags   = %TTF_SUBCLASS OR %TTF_IDISHWND
            ti.hWnd     = hDlg
            ti.uId      = GetDlgItem(hDlg, id)
            ti.lpszText = VARPTR(ttxt)
            SendMessage hWnd_ToolTip, %TTM_ADDTOOL, 0, BYVAL VARPTR(ti)
    END SUB

    ------------------
    [email protected]o.com
Working...
X