2.48. types.lua_widget

dt_type

Common parent type for all lua-handled widgets

Attributes:

2.48.1. types.lua_widget.sensitive

boolean

Set if the widget is enabled/disabled

Attributes:

2.48.2. types.lua_widget.tooltip

string or nil

Tooltip to display for the widget

Attributes:

2.48.3. types.lua_widget.reset_callback

function( 
	widget : types.lua_widget
)

A function to call when the widget needs to reset itself

Note that some widgets have a default implementation that can be overridden, (containers in particular will recursively reset their children). If you replace that default implementation you need to reimplement that functionality or call the original function within your callback

Attributes:
widget
types.lua_widget

The widget that triggered the callback

2.48.4. types.lua_widget.As a function

function( 
	attibutes : table
) : types.lua_widget

Using a lua widget as a function Allows to set multiple attributes of that widget at once. This is mainly used to create UI elements in a more readable way

For example:

local widget = dt.new_widget("button"){
    label ="my label",
    clicked_callback = function() print "hello world" end
    }

attibutes
table

A table of attributes => value to set

return
types.lua_widget

The object called itself, to allow chaining