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

Method Init

core/keybutton.go:23–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21func (km *KeyMapButton) WidgetValue() any { return &km.MapName }
22
23func (km *KeyMapButton) Init() {
24 km.Button.Init()
25 km.SetType(ButtonTonal)
26 km.Updater(func() {
27 km.SetText(string(km.MapName))
28 })
29 InitValueButton(km, false, func(d *Body) {
30 d.SetTitle("Select a key map")
31 si := 0
32 _, curRow, _ := keymap.AvailableMaps.MapByName(km.MapName)
33 tv := NewTable(d).SetSlice(&keymap.AvailableMaps).SetSelectedIndex(curRow).BindSelect(&si)
34 tv.OnChange(func(e events.Event) {
35 name := keymap.AvailableMaps[si]
36 km.MapName = keymap.MapName(name.Name)
37 })
38 })
39}
40
41// KeyChordButton represents a [key.Chord] value with a button.
42type KeyChordButton struct {

Callers

nothing calls this directly

Calls 13

MapNameTypeAlias · 0.92
InitValueButtonFunction · 0.85
UpdaterMethod · 0.80
MapByNameMethod · 0.80
BindSelectMethod · 0.80
SetSelectedIndexMethod · 0.80
NewTableFunction · 0.70
InitMethod · 0.65
SetTitleMethod · 0.65
SetTypeMethod · 0.45
SetTextMethod · 0.45
SetSliceMethod · 0.45

Tested by

no test coverage detected