improve button/on_click
This commit is contained in:
@@ -45,10 +45,6 @@ function button:init(name, bounds, text, on_action)
|
||||
self:option_set("mouseable", true)
|
||||
self:action_set(action.ac_on_enter, on_action)
|
||||
self:action_set(action.ac_on_clicked, function (v)
|
||||
-- FIXME
|
||||
if v:parent()._do_select then
|
||||
v:parent():_do_select()
|
||||
end
|
||||
v:action_on(action.ac_on_enter)
|
||||
return true
|
||||
end)
|
||||
|
@@ -87,7 +87,12 @@ function choicebox:_do_insert(value, index, selected)
|
||||
local text = (selected and "(X) " or "( ) ") .. tostring(value)
|
||||
|
||||
-- init a value item view
|
||||
local item = button:new("choicebox.value." .. self:count(), rect:new(0, self:count(), self:width(), 1), text)
|
||||
local item = button:new("choicebox.value." .. self:count(),
|
||||
rect:new(0, self:count(), self:width(), 1),
|
||||
text,
|
||||
function (v, e)
|
||||
self:_do_select()
|
||||
end)
|
||||
|
||||
-- attach this index
|
||||
item:extra_set("index", index)
|
||||
|
@@ -118,7 +118,12 @@ end
|
||||
function menuconf:_do_insert(config)
|
||||
|
||||
-- init a config item view
|
||||
local item = button:new("menuconf.config." .. self:count(), rect:new(0, self:count(), self:width(), 1), tostring(config))
|
||||
local item = button:new("menuconf.config." .. self:count(),
|
||||
rect:new(0, self:count(), self:width(), 1),
|
||||
tostring(config),
|
||||
function (v, e)
|
||||
self:_do_select()
|
||||
end)
|
||||
|
||||
-- attach this config
|
||||
item:extra_set("config", config)
|
||||
|
Reference in New Issue
Block a user