mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 02:17:52 +02:00
Add on_change_value to input property widget
This commit is contained in:
parent
2b68117527
commit
a2b273762d
@ -18,6 +18,7 @@
|
||||
- [druid](#druid)
|
||||
- [selected](#selected)
|
||||
- [rich_input](#rich_input)
|
||||
- [on_change_value](#on_change_value)
|
||||
|
||||
|
||||
|
||||
@ -88,3 +89,5 @@ property_input:on_change(callback, [callback_context])
|
||||
<a name="rich_input"></a>
|
||||
- **rich_input** (_druid.rich_input_): The component that handles a rich text input field, it's a wrapper around the druid.input component
|
||||
|
||||
<a name="on_change_value"></a>
|
||||
- **on_change_value** (_event.event_): fun(text) Event triggered when the value of the input changes.
|
||||
|
@ -1,9 +1,12 @@
|
||||
local event = require("event.event")
|
||||
|
||||
---@class druid.widget.property_input: druid.widget
|
||||
---@field root node
|
||||
---@field container druid.container
|
||||
---@field text_name druid.text
|
||||
---@field button druid.button
|
||||
---@field druid druid.instance
|
||||
---@field on_change_value event fun(text: string)
|
||||
local M = {}
|
||||
|
||||
function M:init()
|
||||
@ -19,6 +22,12 @@ function M:init()
|
||||
self.container = self.druid:new_container(self.root)
|
||||
self.container:add_container("text_name")
|
||||
self.container:add_container("E_Anchor")
|
||||
|
||||
self.on_change_value = event.create()
|
||||
|
||||
self.rich_input.input.on_input_unselect:subscribe(function(_, text)
|
||||
self.on_change_value:trigger(text)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user