allow mouse lclick to select a List item

develop
myk002 2022-07-16 22:18:38 -07:00 committed by Myk
parent 1dd3d6656b
commit b7f74fe2ce
1 changed files with 9 additions and 0 deletions

@ -1019,6 +1019,15 @@ function List:onInput(keys)
elseif self.on_submit2 and keys.SEC_SELECT then elseif self.on_submit2 and keys.SEC_SELECT then
self:submit2() self:submit2()
return true return true
elseif keys._MOUSE_L then
local _, mouse_y = self:getMousePos()
if mouse_y and #self.choices > 0 and
mouse_y < (#self.choices-self.page_top+1) * self.row_height then
local idx = self.page_top + math.floor(mouse_y/self.row_height)
self:setSelected(idx)
self:submit()
return true
end
else else
for k,v in pairs(self.scroll_keys) do for k,v in pairs(self.scroll_keys) do
if keys[k] then if keys[k] then