OnEvent("Focus") _probably_ not working in Keysharp

Issue #30 closed
Winter Laite created an issue

Working AHK code:

MyGui := Gui(, "Groupbox")
MyGui.Opt("+AlwaysOnTop")
MyEdit := MyGui.Add("Edit", "w200 h200")
MyEdit.OnEvent("Focus", StartEditToolTip)
MyMoney := MyGui.Add("Text", , "I'm only in it for the money...")
MyGui.Show()

StartEditToolTip(*) {
ToolTipText := "
(
I should be a ToolTip.
Am I a ToolTip?
Or am I a tool?
)"
    ToolTip(ToolTipText)
    Sleep(2000)
    ToolTip()
    ControlFocus(MyMoney, "GroupBox")
}

Non-working Keysharp code:

MyGui := Gui(, "Groupbox")
MyGui.Opt("+AlwaysOnTop")
MyEdit := MyGui.Add("Edit", "w200 h200")
MyEdit.OnEvent("Focus", "StartEditToolTip")
MyMoney := MyGui.Add("Text", , "I'm only in it for the money...")
MyGui.Show()

StartEditToolTip() {
ToolTipText := "
(
I should be a ToolTip.
Am I a ToolTip?
Or am I a tool?
)"
    ToolTip(ToolTipText)
    Sleep(2000)
    ToolTip()
    ControlFocus(MyMoney, "GroupBox")
}

Comments (4)

  1. Winter Laite reporter

    Retest following commit of Aug 19 2022, with fix for typo in my code that you caught.

    MyGui := Gui(, "GroupBox")
    MyGui.Opt("+AlwaysOnTop")
    MyEdit := MyGui.Add("Edit", "w200 h200")
    MyEdit.OnEvent("Focus", "StartEditToolTip")
    MyMoney := MyGui.Add("Text", , "I'm only in it for the money...")
    MyGui.Show()
    
    StartEditToolTip() {
    ToolTipText := "
    (
    I should be a ToolTip.
    Am I a ToolTip?
    Or am I a tool?
    )"
        ToolTip(ToolTipText)
        Sleep(2000)
        ToolTip()
        ControlFocus(MyMoney, "GroupBox")
    }
    

    Working, please mark as resolved and close. Thanks!

  2. Log in to comment