-
Notifications
You must be signed in to change notification settings - Fork 78
(API) Column List
The column list object is similar to the list object except it only displays vertically and has columns. Rows can be added with column specific information.
local frame = loveframes.Create("frame")
frame:SetName("Column List")
frame:SetSize(500, 300)
frame:CenterWithinArea(unpack(demo.centerarea))
local list = loveframes.Create("columnlist", frame)
list:SetPos(5, 30)
list:SetSize(490, 265)
list:AddColumn("Column 1")
list:AddColumn("Column 2")
list:AddColumn("Column 3")
list:AddColumn("Column 4")
for i=1, 20 do
list:AddRow("Row " ..i.. ", column 1", "Row " ..i.. ", column 2", "Row " ..i.. ", column 3", "Row " ..i.. ", column 4")
end
Called when a row within the object is clicked
Arguments passed: self [object], row [object], row data [table]
local columnlist = loveframes.Create("columnlist")
columnlist.OnRowClicked = function(parent, row, rowdata)
for k, v in ipairs(rowdata) do
print("Column " ..k.. ": " ..v)
end
end
Called every time the list is scrolled
Arguments passed: self [object]
local list = loveframes.Create("list")
list.OnScroll = function(object)
print("The list was scrolled.")
end
Called when a row is right-clicked
Arguments passed: parent [object], row [object], data [table]
local list = loveframes.Create("list")
list.OnRowRightClicked = function(parent, row, data)
print("A row was right-clicked.")
end
Called when a row is selected
Arguments passed: parent [object], row [object], data [table]
local list = loveframes.Create("list")
list.OnRowSelected = function(parent, row, data)
print("A row was selected.")
end
Methods
Adjusts the width of the object's columns
Note: This method is used by the object internally. You should not use it unless you know what you are doing.
object:AdjustColumns()
Adds a column to the object
object:AddColumn(name[string])
Adds a row to the object
Note: Each argument is for a column (ex: argument will be for column 1).
object:AddRow(...[string or number])
Adds a row to the object
Returns 2 values: column width [number], column height [number]
local w, h = object:GetColumnSize()
Gets the width and height of a column
This is used to specify how many color alternations rows should have. Each row that is added to the object will have a higher color index than the previous row. When it reaches the max color index the color alternator will start at 1 again. These color index ids will be accessible via the column list row drawing function, making it easier to have multicolored rows.
object:SetMaxColorIndex(max[number])
Removes all items from the object's list
object:Clear()
Sets whether the object should auto scroll when a new item is added. If set to true, the object will scroll to the end of itself when a new item is added to it.
object:SetAutoScroll(autoscroll[boolean])
Sets the amount that the object's scroll buttons will scroll the object's list items by
object:SetButtonScrollAmount(scrollamount[number])
Sets the amount that the object's scroll buttons will scroll the object's list items by
Returns 1 value: scroll amount [number]
local scrollamount = object:GetButtonScrollAmount()
Sets the amount that the mouse wheel will scroll the object's list items by
object:SetMouseWheelScrollAmount(scrollamount[number])
Gets the mouse wheel's scroll amount
Returns 1 value: scroll amount [number]
local scrollamount = object:GetMouseWheelScrollAmount()
Sets the height of the object's columns
object:SetColumnHeight(height[number])
Sets whether or not the object should use delta time when caclulating how many pixels it's scrollbar needs to move
object:SetDTScrolling(dtscrolling[boolean])
Gets whether or not the object should use delta time when calculating how many pixels its scrollbar needs to move
Returns 1 value: dtscrolling [boolean]
local dtscrolling = object:GetDTScrolling()
Selects the specified row
object:SelectRow(row[object], ctrl[boolean])
De-selects the specified row
object:DeselectRow(row[object])
##GetSelectedRows Gets the object's selected rows
Returns 1 value: rows [table]
local rows = object:GetSelectedRows()
Sets whether or not the object's rows can be selected
object:SetSelectionEnabled(enabled[boolean])
##GetSelectionEnabled Gets whether or not the object's rows can be selected
Returns 1 value: enabled [boolean]
local enabled = object:GetSelectionEnabled()
Sets whether or not multiple rows can be selected at the same time
object:SetMultiselectionEnabled(enabled[boolean])
Gets whether or not multiple rows can be selected at the same time
Returns 1 value: enabled [boolean]
local enabled = object:GetMultiselectionEnabled()
Removes the specified column
object:RemoveColumn(id[number])
Sets the specified column's name
object:SetColumnName(id[number], name[string])
Removes the specified row
object:RemoveRow(id[number])
Sets the text of the specified column on the specified row
object:SetRowColumnText(text[string], rowid[number], columnid[number])
Sets the text for each column on the specified row
object:SetRowColumnText(rowid[number], columndata[table])
Sets the object's height to the combined height of its children. If max is specified, the object will not become higher than max.
object:SizeToChildren(max[number])