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

Method handleWidgetStateFromFocus

core/widgetevents.go:414–432  ·  view source on GitHub ↗

handleWidgetStateFromFocus updates standard State flags based on Focus events

()

Source from the content-addressed store, hash-verified

412
413// handleWidgetStateFromFocus updates standard State flags based on Focus events
414func (wb *WidgetBase) handleWidgetStateFromFocus() {
415 wb.OnFocus(func(e events.Event) {
416 if wb.AbilityIs(abilities.Focusable) {
417 wb.ScrollToThis()
418 wb.SetState(true, states.Focused)
419 if wb.Styles.VirtualKeyboard != styles.KeyboardNone {
420 TheApp.ShowVirtualKeyboard(wb.Styles.VirtualKeyboard)
421 }
422 }
423 })
424 wb.OnFocusLost(func(e events.Event) {
425 if wb.AbilityIs(abilities.Focusable) {
426 wb.SetState(false, states.Focused)
427 if wb.Styles.VirtualKeyboard != styles.KeyboardNone {
428 TheApp.HideVirtualKeyboard()
429 }
430 }
431 })
432}
433
434// HandleWidgetMagnifyEvent calls [renderWindow.stepZoom] on [events.Magnify]
435func (wb *WidgetBase) handleWidgetMagnify() {

Callers 1

InitMethod · 0.95

Calls 7

OnFocusMethod · 0.95
AbilityIsMethod · 0.95
ScrollToThisMethod · 0.95
SetStateMethod · 0.95
OnFocusLostMethod · 0.95
ShowVirtualKeyboardMethod · 0.65
HideVirtualKeyboardMethod · 0.65

Tested by

no test coverage detected