Skip to content

Commit

Permalink
treeview demo: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Berbizier (dbdl) committed Jan 18, 2014
1 parent 2a447cb commit dce761a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
13 changes: 2 additions & 11 deletions Source/lua/LTreeViewItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ new = function(self, name, json, parent)
return (string.lower(a) < string.lower(b)) and -1 or 1
end)
-- use
--[[
---[[
tvi:paintItem(function(...)
local field = self.name
local value;
Expand All @@ -204,23 +204,20 @@ new = function(self, name, json, parent)
-- or
---[[
--[[
tvi:createItemComponent(function(...)
return createItemComponent(self)
end)
--]]
-- or none at all
--local mt = tvi.methods
--require"pl.pretty".dump( tvi.methods )
---[[
local self = setmetatable(self, {
__index = tvi.__index
})
return self
--]]
--return self
end
local mt = {}
Expand All @@ -236,12 +233,6 @@ local xmeta = setmetatable( {}, {
})
return self
end,
--__tostring = function()return"LTreeViewItem"end,
--[[
__gc = function(t)
t.tvi:isManaged(false)
end
--]]
})
module(...)
Expand Down
22 changes: 1 addition & 21 deletions Source/lua/test_treeview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ local ltvi = require"LTreeViewItem"(debug)
-- could be simplified and optimised
---
-- local xtv3 = luce:TreeView("Tree View3")
local xtv2 = luce:TreeView("Tree View2")
local xtv = luce:TreeView("Tree View")
local tv = {}
Expand All @@ -70,15 +68,14 @@ setmetatable(tv, {
})
local tvi = ltvi("nil", require"json".decode(json))--, tv)
local tvi2 = ltvi("nil", require"json".decode(json))
function tv:refresh(...)
print("refreshing...")
local tvi = ltvi("nil", require"json".decode(json), self)
self:setRootItem(tvi)
end
--tv:setColour( tv.ColourIds.backgroundColourId, "dimgrey" )
tv:setColour( tv.ColourIds.backgroundColourId, "dimgrey" )
tv:setOpenCloseButtonsVisible(true)
Expand All @@ -87,27 +84,10 @@ tv:setMultiSelectEnabled( true )
tv:setRootItem( tvi )
local label2 = luce:Label("Another Label")
label2.text = "(left aligned)"
label2:setColour( label2.ColourIds.backgroundColourId, "yellow" )
label2:setJustificationType( label2.JustificationType.left )
local label = luce:Label("A Label")
label.text = "(right aligned)"
label:setColour( label.ColourIds.backgroundColourId, "red" )
label:setJustificationType( label.JustificationType.right )
--
-- initialise callback, where components are displayed
--
mainWindow:initialise(function(...)
mc:addAndMakeVisible( label2 )
label2:setBounds{ 200, 20, 200, 200 } -- give the button some dimensions
mc:addAndMakeVisible( label )
label:setBounds{ 200, 240, 200, 200 } -- give the button some dimensions
mc:addAndMakeVisible( tv ) -- add components to the main component
tv:setBounds{ 50, 50, 600, 500 }
--mc:setBounds{ 50, 50, 800, 600 } -- set the component bounds
Expand Down

0 comments on commit dce761a

Please sign in to comment.