mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
improve combobox and menu design
This commit is contained in:
@@ -33,6 +33,8 @@ function UIComboBox:onMousePress(mousePos, mouseButton)
|
||||
end
|
||||
menu:setWidth(self:getWidth())
|
||||
menu:display({ x = self:getX(), y = self:getY() + self:getHeight() })
|
||||
connect(menu, { onDestroy = function() self:setOn(false) end })
|
||||
self:setOn(true)
|
||||
return true
|
||||
end
|
||||
|
||||
|
@@ -10,11 +10,6 @@ function UIPopupMenu.create()
|
||||
return menu
|
||||
end
|
||||
|
||||
function UIPopupMenu:destroy()
|
||||
table.removevalue(displayedMenuList, self)
|
||||
UIWidget.destroy(self)
|
||||
end
|
||||
|
||||
function UIPopupMenu:display(pos)
|
||||
-- don't display if not options was added
|
||||
if self:getChildCount() == 0 then
|
||||
@@ -45,6 +40,10 @@ function UIPopupMenu:addSeparator()
|
||||
createWidget(self:getStyleName() .. 'Separator', self)
|
||||
end
|
||||
|
||||
function UIPopupMenu:onDestroy()
|
||||
table.removevalue(displayedMenuList, self)
|
||||
end
|
||||
|
||||
function UIPopupMenu:onMousePress(mousePos, mouseButton)
|
||||
-- clicks outside self area destroys the self
|
||||
if not self:containsPoint(mousePos) then
|
||||
|
Reference in New Issue
Block a user