Is it possible to get modifier key status when a button clicked? #3351
-
Checklist
Is your feature request related to a problem?I need to get modifer keys (cmd/shift/ctrl/alt ) status when mouse click a button Is it possible to construct a solution with the existing API?No response Describe the solution you'd like to see.In a web page, it is very convenient to get modifier key status: document.body.addEventListener('click', e => {
if (e.shiftKey) {
// do one thing if button clicked with holding the shift key
} else {
// do another thing
}
}); Is is possible in fyne? button := widget.NewButton("OK", func (event fyne.KeyEvent) {
if event.ShiftKey {
// do one thing if button clicked with holding the shift key
} else {
// do another thing
}
}) Or is there another way to get modifier key status? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Please use discussions for questions, not issues. I will transfer this to the discussions page. |
Beta Was this translation helpful? Give feedback.
-
What you post as equivalent web code actually isn't. A button being tapped is not a click event - it is an abstraction of mouse/touch coded into the button widget. |
Beta Was this translation helpful? Give feedback.
What you post as equivalent web code actually isn't. A button being tapped is not a click event - it is an abstraction of mouse/touch coded into the button widget.
If you listen to the actual mouse events they have a modifier set just like on the web https://developer.fyne.io/api/v2.1/driver/desktop/mouseable.html. Of course that code is desktop specific, as a touchscreen does not work that way.