Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

EventNameTrayEventClicked Not working #305

Open
Dontmindmes opened this issue Jan 18, 2021 · 4 comments
Open

EventNameTrayEventClicked Not working #305

Dontmindmes opened this issue Jan 18, 2021 · 4 comments
Assignees
Labels

Comments

@Dontmindmes
Copy link

// Add a listener on the window w.On(astilectron.EventNameTrayEventDoubleClicked, func(e astilectron.Event) (deleteListener bool) { fmt.Println("Clicked on try") return })

I run this, i created a tray
`var t = a.NewTray(&astilectron.TrayOptions{
Image: astikit.StrPtr("D:\Experiments\Toast\icon.png"),
Tooltip: astikit.StrPtr("Tray's tooltip"),
})

// Create tray
t.Create()`

the click does register in console
2021/01/17 21:38:02 Astilectron says: {"name":"tray.event.clicked","targetID":"4","bounds":{"x":1272,"y":824,"width":24,"height":40}}
but not by the code

@asticode asticode self-assigned this Jan 18, 2021
@asticode
Copy link
Owner

I think you need to listen to EventNameTrayEventClicked instead of EventNameTrayEventDoubleClicked (without Double)

@Dontmindmes
Copy link
Author

I think you need to listen to EventNameTrayEventClicked instead of EventNameTrayEventDoubleClicked (without Double)

w.On(astilectron.EventNameTrayEventClicked, func(e astilectron.Event) (deleteListener bool) { fmt.Println("WORKS") return })

I did try that but nothing happens, console shows that tray is being clicked but that function is doing nothing

@asticode
Copy link
Owner

Mmmm I've just tested with the demo and it's working fine on my end. Can you share your code to see whether the problem is coming from elsewhere ?

@SchmidtDawid
Copy link

The solution is:
You have to listen tray. Not window.

t.On(...) instead w.On(...)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants