dcsimg
Results 1 to 7 of 7

Thread: [VB6] - Multi-line standard tooltip.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2015
    Posts
    1,329

    [VB6] - Multi-line standard tooltip.


    Standard tooltip (property "ToolTipText" of controls) does not support multi-line text and displays all the text on one line. Suggest module that supports "multiline" standard tooltip based on subclassing windows tooltip. Can, in principle, and the color and design to change the tooltip if you wish, I left the standard; You can also add width adjustment (so as not to produce a lot of code I left centered), commented on almost every line. Button to stop the project after the launch of "hook" can not be otherwise crash IDE (I have Win7 (64), not falling apart; always took off on XP), it is necessary to close the window and call "Unhook".

    MultilineTooltip_eng.zip

  2. #2
    Addicted Member
    Join Date
    Aug 2016
    Posts
    168

    Re: [VB6] - Multi-line standard tooltip.

    I tried few methods either by a resource file or manifest, but I can't get themed tooltips. Are you using hard code to draw tooltips?

    Code:
    Case WM_PAINT
            BeginPaint hwnd, ps                                                                 
            md = GetBkMode(ps.hdc)                                                              
            oft = SelectObject(ps.hdc, hFont)                                                 
            SetBkMode ps.hdc, TRANSPARENT                                                       
            DrawText ps.hdc, s, Len(s), RC, DT_WORDBREAK Or DT_CENTER                           
            SelectObject ps.hdc, oft                                                            
            SetBkMode ps.hdc, md                                                             
            EndPaint hwnd, ps                                                                   
            Exit Function

  3. #3
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,245

    Re: [VB6] - Multi-line standard tooltip.

    Once you're doing drawing yourself like that, shouldn't you simply be able to use the Theme API? Mainly the DrawThemeBackground function...
    Code:
    TOOLTIP	TTP_BALLOON	TTBS_LINK, TTBS_NORMAL
    	TTP_BALLOONSTEM	TTBSS_POINTINGUPLEFTWALL, TTBSS_POINTINGUPCENTERED, TTBSS_POINTINGUPRIGHTWALL, TTBSS_POINTINGDOWNRIGHTWALL, TTBSS_POINTINGDOWNCENTERED, TTBSS_POINTINGDOWNLEFTWALL
    	TTP_BALLOONTITLE	
    	TTP_CLOSE	TTCS_HOT, TTCS_NORMAL, TTCS_PRESSED
    	TTP_STANDARD	TTSS_LINK, TTSS_NORMAL
    	TTP_STANDARDTITLE	TTSS_LINK, TTSS_NORMAL
    	TTP_WRENCH (Windows 7)	TTWS_NORMAL, TTWS_HOT, TTWS_PRESSED
    Theme Parts and States (MSDN)

  4. #4
    Addicted Member
    Join Date
    Aug 2016
    Posts
    168

    Re: [VB6] - Multi-line standard tooltip.

    Quote Originally Posted by fafalone View Post
    Once you're doing drawing yourself like that, shouldn't you simply be able to use the Theme API? Mainly the DrawThemeBackground function...
    Code:
    TOOLTIP	TTP_BALLOON	TTBS_LINK, TTBS_NORMAL
    	TTP_BALLOONSTEM	TTBSS_POINTINGUPLEFTWALL, TTBSS_POINTINGUPCENTERED, TTBSS_POINTINGUPRIGHTWALL, TTBSS_POINTINGDOWNRIGHTWALL, TTBSS_POINTINGDOWNCENTERED, TTBSS_POINTINGDOWNLEFTWALL
    	TTP_BALLOONTITLE	
    	TTP_CLOSE	TTCS_HOT, TTCS_NORMAL, TTCS_PRESSED
    	TTP_STANDARD	TTSS_LINK, TTSS_NORMAL
    	TTP_STANDARDTITLE	TTSS_LINK, TTSS_NORMAL
    	TTP_WRENCH (Windows 7)	TTWS_NORMAL, TTWS_HOT, TTWS_PRESSED
    Theme Parts and States (MSDN)
    Thanks. I got it.

  5. #5
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    101

    Re: [VB6] - Multi-line standard tooltip.

    Trick,

    I run 64-bit Windows 10. I can't get your sample program to work correctly in the IDE. It works fine as a compiled EXE but in the IDE each of the tooltips flash once and then don't show. But even stranger, the one string S(2) in your form load that has 7 lines of text sometimes displays and stays displayed but none of the others ever remain displayed. Is this intentional?

    Also, I am guessing that the comments in your code are in cyrillic but since I don't have that as an ANSI code page I can't translate them. Would it be possible to save your two code files in UTF-8 so that we can see and then translate your comments? Thanks.

  6. #6

  7. #7
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    101

    Re: [VB6] - Multi-line standard tooltip.

    Thanks for the comment translations. However, I am still getting the same performance of the tooltips in the IDE. the 7-line one generally stays displayed but the others just appear momentarily. That doesn't happen when executing the program outside the IDE.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width