openMenu opens any menu associated with this element. It returns whether any menu was opened.
(e events.Event)
| 303 | // openMenu opens any menu associated with this element. |
| 304 | // It returns whether any menu was opened. |
| 305 | func (bt *Button) openMenu(e events.Event) bool { |
| 306 | if !bt.HasMenu() { |
| 307 | return false |
| 308 | } |
| 309 | pos := bt.ContextMenuPos(e) |
| 310 | if indic := bt.ChildByName("indicator", 3); indic != nil { |
| 311 | pos = indic.(Widget).ContextMenuPos(nil) // use the pos |
| 312 | } |
| 313 | m := NewMenu(bt.Menu, bt.This.(Widget), pos) |
| 314 | if m == nil { |
| 315 | return false |
| 316 | } |
| 317 | m.Run() |
| 318 | return true |
| 319 | } |
| 320 | |
| 321 | func (bt *Button) handleClickDismissMenu() { |
| 322 | // note: must be called last so widgets aren't deleted when the click arrives |
no test coverage detected