Jump to content

Problem: GUICtrlToolTip is only shown once


 Share

Recommended Posts

Hi,

when i create a ToolTip for a control, there is a problem.

If you leave the mouse on the Ctrl until the tooltip disappears by itself, it doesn't appear again.

(Yes, i moved the mouse to another position and then back onto the Ctrl with the tooltip.)

If the mouse is moved away, before the deadline of the tooltip is reached, then it appears again on mouse hover.

Some kind of a bug?

What can i do?

Regards,

Andi

Link to comment
Share on other sites

Works fine for me.

#include <GUIConstants.au3>

GUICreate('', 80, 70)
$btn1 = GUICtrlCreateButton('Button 1', 10, 10, 60, 20)
$btn2 = GUICtrlCreateButton('Button 2', 10, 40, 60, 20)

GUICtrlSetTip($btn1, 'This is button 1')
GUICtrlSetTip($btn2, 'This is button 2')

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    Sleep(50)
WEnd

Lets see a sample of what's not working for you.

Link to comment
Share on other sites

Btw: you don't have to set a delay ("sleep(50)") in your script's idle loop, if you use the GUIGetMsg-Mode. GUIGetMsg() idles the cpu automatically...

Ok, here is my script. Don't wonder, if you cannot read all the text: --> made in germany.

The big room at top of the GUI is a placeholder for a picture...

In the GUI, the tooltip is at that label, showing the value 80.0 at the beginning. It's behind "BMI-Wert:"...

(--> it's a body-mass-index calculator.)

#NoTrayIcon
#include <GuiConstants.au3>
#include <GUISlider.au3>
Opt("GuiOnEventMode", 1)
;FileInstall("bmi.jpg", @TempDir &"\autoit_bmirechner.jpg", 1)

;Variablen
;~ $pic = @TempDir &"\autoit_bmirechner.jpg"
Dim $bmi_profil[6] = ["20-25", "21-26", "22-27", "23-28", "24-29", "25-30"] ;Mann



GuiCreate("BMI-Rechner", 580, 380)
    GUISetOnEvent($gui_event_close, "_quit")
    
    
;~ GUICtrlCreatePic($pic, 0, 0, 580, 80)
GUICtrlCreateLabel("", 0, 81, 581, 2, $SS_SUNKEN)
    
    
    
GuiCtrlCreateGroup("Eingabe", 10, 110, 560, 120)
GuiCtrlCreateLabel("Gewicht in kg:", 30, 140, 70, 20, $SS_CENTERIMAGE)
GuiCtrlCreateLabel("Größe in cm:", 30, 190, 70, 20, $SS_CENTERIMAGE)
$sli_kg = GuiCtrlCreateSlider(120, 136, 380, 40, $TBS_NOTICKS)
    GUICtrlSetLimit(-1, 1500, 200)
$sli_cm = GuiCtrlCreateSlider(120, 186, 380, 40, $TBS_NOTICKS)
    GUICtrlSetLimit(-1, 200, 50)
$lbl_kg = GUICtrlCreateLabel(" 20", 510, 140, 40, 20, $SS_SUNKEN + $SS_CENTERIMAGE)
$lbl_cm = GUICtrlCreateLabel(" 50", 510, 190, 40, 20, $SS_SUNKEN + $SS_CENTERIMAGE)

GUICtrlCreateGroup("Geschlecht", 10, 250, 90, 70)
$gender = GUICtrlCreateButton("Mann", 30, 280, 50, 20)
GUICtrlSetOnEvent(-1, "_gender")

GUICtrlCreateGroup("Alter", 110, 250, 280, 70)
$sli_age = GUICtrlCreateSlider(130, 276, 180, 40, $TBS_NOTICKS)
Dim $age[6] = ["19-24", "25-34", "35-44", "45-54", "55-64", "65+"]
GUICtrlSetLimit(-1, 5, 0)
GUICtrlSetData(-1, 6)
GUICtrlSetOnEvent(-1, "_slider")
$lbl_age = GUICtrlCreateLabel(" 65+", 320, 280, 50, 20, $SS_SUNKEN + $SS_CENTERIMAGE)


GuiCtrlCreateGroup("Ausgabe", 400, 250, 170, 70)
GUICtrlSetFont(-1, 9, 600)
GuiCtrlCreateLabel("BMI-Wert:", 420, 283, 70, 20)
GUICtrlSetFont(-1, 9, 600)
$lbl_bmi = GuiCtrlCreateLabel("", 490, 280, 60, 20, $SS_SUNKEN + $SS_CENTERIMAGE)
GUICtrlSetFont(-1, 9, 600)






; SO AND HERE IS THAT TOOLTIP THAT...


GUICtrlSetTip(-1, "Farben:" & @CRLF & "Rot = untergewichtig" & @CRLF & "Grün = normalgewichtig" & @CRLF & "Orange = übergewichtig")









$cmd_info = GUICtrlCreateButton("Info »", 10, 350, 40, 20)
GUICtrlSetOnEvent(-1, "_info")
$lbl_info = GUICtrlCreateLabel("Feineinstellungen mit den Pfeiltasten LINKS/RECHTS möglich." & @CRLF & "Programmiert von (ZDL). Weitergabe erwünscht.", 10, 340, 304, 30, $SS_SUNKEN)
    GUICtrlSetColor(-1, 0x898989)
    GUICtrlSetFont(-1, 8)
    GUICtrlSetState(-1, $GUI_HIDE)
    
    
$cmd_quit = GuiCtrlCreateButton("Beenden", 500, 350, 70, 20)
GUICtrlSetOnEvent(-1, "_quit")
    
    

GuiSetState()
While 1
    Sleep(100)
    If GUICtrlRead($sli_kg)/10 <> GUICtrlRead($lbl_kg) Or GUICtrlRead($sli_cm) <> GUICtrlRead($lbl_cm) Or GUICtrlRead($lbl_age) <> " " & $age[GUICtrlRead($sli_age)] & " J." Then _slider()
WEnd



Func _slider()
    GUICtrlSetData($lbl_kg, " " & StringFormat("%.1f", GUICtrlRead($sli_kg)/10))
    GUICtrlSetData($lbl_cm, " " & GUICtrlRead($sli_cm))
    GUICtrlSetData($lbl_age, " " & $age[GUICtrlRead($sli_age)] & " J.")
    
    $kg = GUICtrlRead($sli_kg)/10
    $m = GUICtrlRead($sli_cm)/100
    $bmi = Round($kg / $m / $m, 1)
    GUICtrlSetData($lbl_bmi, " " & StringFormat("%.1f", $bmi))
    
    Select
        Case $bmi < StringLeft($bmi_profil[GUICtrlRead($sli_age)], 2)
            GUICtrlSetColor($lbl_bmi, 0xff0000)
        Case $bmi >= StringLeft($bmi_profil[GUICtrlRead($sli_age)], 2) And $bmi <= StringRight($bmi_profil[GUICtrlRead($sli_age)], 2)
            GUICtrlSetColor($lbl_bmi, 0x008141)
        Case $bmi > StringRight($bmi_profil[GUICtrlRead($sli_age)], 2)
            GUICtrlSetColor($lbl_bmi, 0xDD7300)
    EndSelect
EndFunc


Func _gender()
    If GUICtrlRead($gender) = "Mann" Then
        GUICtrlSetData($gender, "Frau")
        Dim $bmi_profil[6] = ["19-24", "20-25", "21-26", "22-27", "23-28", "24-29"] ;Frau
    Else
        GUICtrlSetData($gender, "Mann")
        Dim $bmi_profil[6] = ["20-25", "21-26", "22-27", "23-28", "24-29", "25-30"] ;Mann
    EndIf
    _slider()
EndFunc



Func _info()
    If GUICtrlRead($cmd_info) = "Info »" Then
        GUICtrlSetPos($cmd_info, 314, 340, 20, 30)
        GUICtrlSetData($cmd_info, "«")
        GUICtrlSetState($lbl_info, $GUI_SHOW)
    Else
        GUICtrlSetState($lbl_info, $GUI_HIDE)
        GUICtrlSetPos($cmd_info, 10, 350, 40, 20)
        GUICtrlSetData($cmd_info, "Info »")
    EndIf
    


EndFunc





Func _quit()
    ;FileDelete($pic)
    Exit
EndFunc
Edited by Der_Andi
Link to comment
Share on other sites

  • 5 months later...

Perhaps it's because of the Label. I tried on buttons, too. No Problems. But Labels...

Same problem here. I guess this should be in bug report to adjust the "Label" thing. Working with buttons.

Here's what you can test...

GUICreate("My GUI control tip")  ; will create a dialog box that when displayed is centered

$LABEL = GUICtrlCreateLabel ("my label", 10,20)
GUICtrlSetTip($LABEL,"tip of my label")
$BUTTON = GUICtrlCreateButton ("my button", 70,15)
GUICtrlSetTip($BUTTON,"tip of my button")

                
GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

[font="Lucida Sans Unicode"]M a k. a v e L ![/font]

Link to comment
Share on other sites

I have the same problem when i set the tip with title, so if i click on the label, and then hover the mouse on it, the tooltip is not shown...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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...