Fixed an issue with certain event callbacks

This commit is contained in:
Kenny Shields 2012-05-05 23:35:10 -04:00
parent 5fe9cdb806
commit 846f7cb60f
5 changed files with 15 additions and 14 deletions

View File

@ -280,9 +280,6 @@ function loveframes.debug.ExamplesMenu()
list1:AddColumn("Column 2")
list1:AddColumn("Column 3")
list1:AddColumn("Column 4")
list1.OnRowClicked = function(parent, row, rowdata)
print(unpack(rowdata))
end
for i=1, 20 do
list1:AddRow("Row " ..i.. ", column 1", "Row " ..i.. ", column 2", "Row " ..i.. ", column 3", "Row " ..i.. ", column 4")

View File

@ -120,7 +120,9 @@ function button:mousereleased(x, y, button)
if hover == true and down == true and button == "l" and clickable == true then
if enabled == true then
self.OnClick(self, x, y)
if self.OnClick then
self.OnClick(self, x, y)
end
end
end

View File

@ -75,6 +75,15 @@ function columnlistrow:draw()
skin.DrawColumnListRow(self)
end
local cwidth, cheight = self:GetParent():GetParent():GetColumnSize()
local x = 5
for k, v in ipairs(self.columndata) do
local height = self.font:getHeight("a")
love.graphics.print(v, self.x + x, self.y + self.height/2 - height/2)
x = x + cwidth
end
end
--[[---------------------------------------------------------

View File

@ -71,7 +71,9 @@ function sliderbutton:update(dt)
if nvalue ~= pvalue then
self.parent.value = loveframes.util.Round(nvalue, self.parent.decimals)
self.parent.OnValueChanged(self.parent, self.parent.value)
if self.parent.OnValueChanged then
self.parent.OnValueChanged(self.parent, self.parent.value)
end
end
if self.Update then

View File

@ -1166,15 +1166,6 @@ function skin.DrawColumnListRow(object)
end
local cwidth, cheight = self:GetParent():GetParent():GetColumnSize()
local x = 5
for k, v in ipairs(self.columndata) do
local height = self.font:getHeight("a")
love.graphics.print(v, self.x + x, self.y + self.height/2 - height/2)
x = x + cwidth
end
end
-- register the skin