Jump to content

Multiple tooltips.


Recommended Posts

For a program I wrote a single mouse-over isn't enough anymore. I need to display multiple lines of information on different locations on the screen. Obviously, when ToolTip() is called multiple times, each previous tooltip is removed from the screen. Thus, is there a way to do this, using tooltips or any other method?

Creating very small windows doesn't do it, as they pose two problems: 1) they hinder operation of the software where the tooltip is shown (with a tooltip mouse clicks aren't affected, with windows a mouse click will activate the software and bring the small windows to the background. 2) they are too big because of the title bar.

jacQues

Link to comment
Share on other sites

The only thing I can think of is creating multiple GUI's and hide them. Then call ToolTip() on the hidden windows.

But I didn't test that. Maybe it works, probably it doesn't...

ToolTip() goes per GUI and not per AU3??? Then how does it know which one? With GUISwitch()? I'll try that later (no time right now).

jacQues

Link to comment
Share on other sites

Hi,

here is an old snippet I found on the German forum:

$tool1 = _ToolTip("Test", 50, 50)
Sleep(1000)
$tool2 = _ToolTip("Test2", 90, 90)
Sleep(500)
_ToolTipDelete($tool1, 1);Ausblenden und dann schließen
Sleep(800)
_ToolTipDelete($tool2);Hart schlißen


Func _ToolTip($sText, $iX, $iY)
   ;By GtaSpider
    
    Local $RetAr[2]
   ;Mainfenster erstellen
    $tooltipmain = GUICreate("", 123, 123, $iX, $iY, -2147483648, 128);$WS_POPUP = -2147483648, $WS_EX_TOOLWINDOW = 128
    GUISetBkColor(0xFFFFE1)
   ;Label mit Text erstellen
    $lab = GUICtrlCreateLabel($sText, 3, 3)
    
    $cgp = ControlGetPos($tooltipmain, "", $lab);Labelgröße rausfinden
    WinMove($tooltipmain, "", $iX, $iY, $cgp[2], $cgp[3]);Gui perfekt formen
   ;Schatten erstellen
    $tooltipshadow = GUICreate("", 123, 123, $iX, $iY, -2147483648, 128);$WS_POPUP = -2147483648, $WS_EX_TOOLWINDOW = 128
    GUISetBkColor(0x0)
    WinSetTrans($tooltipshadow, "", 100)
   ;Schatten perfekt formen
    WinMove($tooltipshadow, "", $iX + 3, $iY + 3, $cgp[2], $cgp[3])
   ;OnTop
    WinSetOnTop($tooltipmain, "", 1)
    WinSetOnTop($tooltipmain, "", 2)
   ;Zeige Tooltip
    GUISetState(@SW_SHOW, $tooltipshadow)
    GUISetState(@SW_SHOW, $tooltipmain)
   ;Bereite das Return array vor, falls man das Tooltip wider entfernen will
    $RetAr[0] = $tooltipmain
    $RetAr[1] = $tooltipshadow
    Return $RetAr
EndFunc  ;==>_ToolTip

Func _ToolTipDelete($aTooltiphwnd, $smooth = 0)
   ;By GtaSpider
    
   ;Löscht das tooltip
    If $smooth Then;Wenn smooth wahr ist dann wird ausgeblendet
        For $i = 255 To 0 Step - 10
            WinSetTrans($aTooltiphwnd[0], "", $i)
            If $i < 101 Then WinSetTrans($aTooltiphwnd[1], "", $i)
            Sleep(10)
        Next
    EndIf
    GUIDelete($aTooltiphwnd[0])
    GUIDelete($aTooltiphwnd[1])
EndFunc  ;==>_ToolTipDelete

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • 7 years later...

Sorry for bumping an old thread but I need this even after those years and I guess I am not alone so if you want to use this useful code just remember to delete this line 

WinSetOnTop($tooltipmain, "", 2)

because it breaks the ontop property. Not sure if it worked in 2008... maybe yes.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...