Jump to content
Sign in to follow this  
DickG

Balloon tip as replacement for GUICtrlSetTip

Recommended Posts

DickG

I wanted a way to prevent a tooltip from timing out. When it times out, I can't get it back unless I restart the app. I was not able to find anything in this forum that worked the way I liked, so I came up with this. Maybe someone can use it.

Dick

#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

Dim $ID[1]
Local $Btn
Local $GUI
Local $dummyEdit
Local $Label_width = 200
Local $Target_label

$GUI = GUICreate("Balloon Tip Trick", 250, 150)

$Target_label = GUICtrlCreateLabel("Click OK to activate balloon tip", 20, 20, $Label_width, 25)

$OK_btn = GUICtrlCreateButton("OK", (250-50)/2, (150-80), 50, 25)

$Close_btn = GUICtrlCreateButton("Close", (250-50)/2, (150-50), 50, 25)

GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()

Switch $nMsg
     Case $GUI_EVENT_CLOSE
         Exit

Case $Close_btn
         Exit

Case $OK_btn
$dummyEdit = GUICtrlCreateEdit("", 20, 35, $Label_width, 1)
         GUICtrlSetData($Target_label, "Balloon tip active")

Case Else
;Get ID of cursor.
$ID = GUIGetCursorInfo()

;If ID[4] (the control ID) matches dummy control [AND optionally some control NOT empty], display balloon tip.
If $ID[4] = $dummyEdit And GUICtrlRead($Target_label) = "Balloon tip active" Then
_GUICtrlEdit_ShowBalloonTip($dummyEdit, "Balloon tip", "Here it is!", $TTI_INFO)
EndIf

ContinueLoop

EndSwitch
WEnd

Share this post


Link to post
Share on other sites
AutoBert

There is a bug in your skript. When minimizing it crashs with error:

>"D:ProgrammeAutoIt3SciTEAutoIt3WrapperAutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:ProgrammeAutoIt3Testasdfa.au3" /autoit3dir "D:ProgrammeAutoIt3" /UserParams   
+>01:26:13 Starting AutoIt3Wrapper v.2.0.0.1    Environment(Language:0407  Keyboard:00000407  OS:WIN_XP/Service Pack 3  CPU:X86 OS:X86)
>Running AU3Check (1.54.19.0)  from:D:ProgrammeAutoIt3
+>01:26:15 AU3Check ended.rc:0
>Running:(3.3.6.1):D:ProgrammeAutoIt3autoit3.exe "D:ProgrammeAutoIt3Testasdfa.au3"   
D:ProgrammeAutoIt3Testasdfa.au3 (44) : ==> Subscript used with non-Array variable.:
If $ID[4] = $dummyEdit And GUICtrlRead($Target_label) = "Balloon tip active" Then
If $ID^ ERROR
->01:26:44 AutoIT3.exe ended.rc:1
+>01:26:45 AutoIt3Wrapper Finished
>Exit code: 1    Time: 34.149

Share this post


Link to post
Share on other sites
DickG

There is a bug in your skript. When minimizing it crashs with error:

Minimizing? Why would you minimize this? This is just a tiny script to show how the balloon tip works. It's not meant to be "robust" (like minimizing). It looks like the problem is pointing to the $ID[4] var. It's declared up front, so I don't know what the problem would be on your end. It comes from a standard command ( GUIGetCursorInfo). But why would you minimize this demo script? Edited by Melba23
Sorted the quote tags

Share this post


Link to post
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
Sign in to follow this  

×