MCPcopy Create free account
hub / github.com/cogentcore/core / openMenu

Method openMenu

core/button.go:305–319  ·  view source on GitHub ↗

openMenu opens any menu associated with this element. It returns whether any menu was opened.

(e events.Event)

Source from the content-addressed store, hash-verified

303// openMenu opens any menu associated with this element.
304// It returns whether any menu was opened.
305func (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
321func (bt *Button) handleClickDismissMenu() {
322 // note: must be called last so widgets aren't deleted when the click arrives

Callers 2

InitMethod · 0.95
StyleMenuSceneFunction · 0.45

Calls 5

HasMenuMethod · 0.95
NewMenuFunction · 0.85
ChildByNameMethod · 0.80
ContextMenuPosMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected