Skip to content

lvgl.momentaryButton

lvgl.momentaryButton([parent, ]params)

Add a momentary text button using the EdgeTX style.

Parameters

NameReqTypeDescription
parentnoobjectoptional LVGL object to attach the new object to; if omitted the object is created in the top-level script window
paramsyestable
FieldTypeDescription
xnumberposition relative to the top-left of the parent
ynumberposition relative to the top-left of the parent
wnumberwidth
hnumberheight
colorcolor or functionprimary color for the object
posfunctiondynamic position callback returning x, y
sizefunctiondynamic size callback returning w, h
visiblefunctiondynamic visibility callback
floatingbooleankeep the object fixed inside a scrollable container, added in 2.11.6, defaults to false
textstring or functiontext displayed in the button, defaults to an empty string
pressfunctioncalled immediately when the user first taps the button or presses ENTER, defaults to nil
releasefunctioncalled when the user releases ENTER or stops touching the screen, defaults to nil
activefunctionsets the enabled/disabled state; must return a boolean, true to enable, defaults to nil
colorcolor or functionbackground color, defaults to the EdgeTX button style PRIMARY2 theme color
textColorcolor or functiontext color, defaults to the EdgeTX button style SECONDARY1 theme color
cornerRadiusnumberradius for the button's corners, defaults to the EdgeTX button style radius
fontfont value or functionsets the font size, e.g. MIDSIZE, DBLSIZE; defaults to STDSIZE

Returns

Name Type Description
- table LVGL object, or nil if not running as a One-Time script or fullscreen widget

Availability

  • Since: 2.11.0
  • Radio support: color-lcd

Notes

  • Only available for One-Time scripts and widgets running in full screen mode -- returns nil otherwise. @notice Unlike lvgl.button, press fires immediately on tap/press rather than on release. The button shows the checked state until ENTER is released or the screen is no longer touched.

Source

radio/src/lua/api_colorlcd_lvgl.cpp