Cannot hide TrayTip on Win10, Win7 status unknown

Issue #14 closed
Winter Laite created an issue

Issue: TrayTip can be created but not hidden. TrayTip (Toast on Win10) does disappear after approximately 5 seconds.

(HideTrayTip function is from AHK docs for v2 beta)

OS: Win10 Pro 64-bit

Code to duplicate issue for Keysharp:

MyGui := Gui(, "KEYSHARP TESTS")

CheckBoxText := MyGui.Add("Text", "w200", "Checkbox test")
CheckBoxText.SetFont("cBlue s10")
CheckBoxOne := MyGui.Add("CheckBox", "w200", "If this text is long, it will wrap automatically")
CheckBoxOne.OnEvent("Click", "CheckBoxOneClicked")

MyGui.Show()


CheckBoxOneClicked() {
IsChecked := ControlGetChecked(CheckBoxOne, "KEYSHARP TESTS")
MsgBox("1 is checked - 0 is unchecked`nTests 'ControlGetChecked' also`n`nValue is: " IsChecked, "Checkbox Test")
TrayTip("TrayTipTest", "Let's see if this works.")
Sleep(1000)
HideTrayTip()
}

HideTrayTip() {
    TrayTip  ; Attempt to hide it the normal way.
    if SubStr(A_OSVersion,1,3) = "10." {
        A_IconHidden := true
        Sleep 200  ; It may be necessary to adjust this sleep.
        A_IconHidden := false
    }
}

Code working in AHK v2.0-beta7:

MyGui := Gui(, "KEYSHARP TESTS")

CheckBoxText := MyGui.Add("Text", "w200", "Checkbox test")
CheckBoxText.SetFont("cBlue s10")
CheckBoxOne := MyGui.Add("CheckBox", "w200", "If this text is long, it will wrap automatically")
CheckBoxOne.OnEvent("Click", CheckBoxOneClicked)

MyGui.Show()


CheckBoxOneClicked(*) {
IsChecked := ControlGetChecked(CheckBoxOne, "KEYSHARP TESTS")
MsgBox("1 is checked - 0 is unchecked`nTests 'ControlGetChecked' also`n`nValue is: " IsChecked, "Checkbox Test")
TrayTip("TrayTipTest", "Let's see if this works.")
Sleep(2000)
HideTrayTip()
}


; Copy this function into your script to use it.
HideTrayTip() {
    TrayTip  ; Attempt to hide it the normal way.
    if SubStr(A_OSVersion,1,3) = "10." {
        A_IconHidden := true
        Sleep 200  ; It may be necessary to adjust this sleep.
        A_IconHidden := false
    }
}

Comments (4)

  1. Matt Feemster repo owner

    Please try this again, I think my previous commit dealing with invoking all GUI calls possibly fixed this. On my machine, it hides the tray tip after 1 second. I assume that’s the intended behavior?

  2. Winter Laite reporter

    For me it is not fixed. Win10 Pro build 19043, 64-bit, latest updates. TrayTip holds for 5 seconds then disappears. The slightly different 2.0-beta.7 code above does work. I experimented with changing “true” to “True” and “false” to “False”, and “Sleep 200” to “Sleep(200)” without success.

  3. Log in to comment