有没有办法在菜单元素上添加事件处理程序?

huangapple go评论107阅读模式
英文:

Is there a way to put an event handler on menu element?

问题

我不认为我需要这些菜单子项。我能否以某种方式处理单击菜单元素本身?

类似这样:

menu := fyne.NewMenu("菜单元素")
menu.Action = func() {
  ...
}
英文:

I don't think I need these menu subitems. Can I somehow handle clicking on the menu element itself?

Something like this:

menu := fyne.NewMenu("Menu Element")
menu.Action = func() {
  ...
}

答案1

得分: 1

没有弹出子项的菜单只是一行按钮,不是吗?可以使用HBox和Button小部件来实现,或者也许你想要一个工具栏?

英文:

A menu without the popup sub-items is just a row of buttons isn’t it? It should be possible to make that with HBox and Button widgets or maybe you want a toolbar instead?

huangapple
  • 本文由 发表于 2021年12月19日 00:41:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/70405227.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定