|
|
@ -152,7 +152,9 @@ ListBox.ATTRS{
|
|
|
|
with_filter = false,
|
|
|
|
with_filter = false,
|
|
|
|
cursor_pen = DEFAULT_NIL,
|
|
|
|
cursor_pen = DEFAULT_NIL,
|
|
|
|
select_pen = DEFAULT_NIL,
|
|
|
|
select_pen = DEFAULT_NIL,
|
|
|
|
on_select = DEFAULT_NIL
|
|
|
|
on_select = DEFAULT_NIL,
|
|
|
|
|
|
|
|
on_select2 = DEFAULT_NIL,
|
|
|
|
|
|
|
|
select2_hint = DEFAULT_NIL,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function ListBox:preinit(info)
|
|
|
|
function ListBox:preinit(info)
|
|
|
@ -168,6 +170,16 @@ function ListBox:init(info)
|
|
|
|
list_widget = widgets.FilteredList
|
|
|
|
list_widget = widgets.FilteredList
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local on_submit2
|
|
|
|
|
|
|
|
if self.select2_hint or self.on_select2 then
|
|
|
|
|
|
|
|
on_submit2 = function(sel, obj)
|
|
|
|
|
|
|
|
self:dismiss()
|
|
|
|
|
|
|
|
if self.on_select2 then self.on_select2(sel, obj) end
|
|
|
|
|
|
|
|
local cb = obj.on_select2
|
|
|
|
|
|
|
|
if cb then cb(obj, sel) end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
self:addviews{
|
|
|
|
self:addviews{
|
|
|
|
list_widget{
|
|
|
|
list_widget{
|
|
|
|
view_id = 'list',
|
|
|
|
view_id = 'list',
|
|
|
@ -182,11 +194,19 @@ function ListBox:init(info)
|
|
|
|
local cb = obj.on_select or obj[2]
|
|
|
|
local cb = obj.on_select or obj[2]
|
|
|
|
if cb then cb(obj, sel) end
|
|
|
|
if cb then cb(obj, sel) end
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
on_submit2 = on_submit2,
|
|
|
|
frame = { l = 0, r = 0 },
|
|
|
|
frame = { l = 0, r = 0 },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ListBox:onRenderFrame(dc,rect)
|
|
|
|
|
|
|
|
ListBox.super.onRenderFrame(self,dc,rect)
|
|
|
|
|
|
|
|
if self.select2_hint then
|
|
|
|
|
|
|
|
dc:seek(rect.x1+2,rect.y2):key('SEC_SELECT'):string(': '..self.select2_hint,COLOR_DARKGREY)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function ListBox:getWantedFrameSize()
|
|
|
|
function ListBox:getWantedFrameSize()
|
|
|
|
local mw, mh = InputBox.super.getWantedFrameSize(self)
|
|
|
|
local mw, mh = InputBox.super.getWantedFrameSize(self)
|
|
|
|
local list = self.subviews.list
|
|
|
|
local list = self.subviews.list
|
|
|
|