From f0349fce0286d78c9a08dfcae97d9af58ed8f8e8 Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Sat, 5 Jul 2014 23:19:33 -0400 Subject: [PATCH] Add tree.OnSelectNode event callback --- objects/internal/treenode.lua | 4 ++++ objects/tree.lua | 1 + 2 files changed, 5 insertions(+) diff --git a/objects/internal/treenode.lua b/objects/internal/treenode.lua index be6f1b8..07321fa 100644 --- a/objects/internal/treenode.lua +++ b/objects/internal/treenode.lua @@ -153,7 +153,11 @@ function newobject:mousepressed(x, y, button) end if self.hover and button == "l" then + local onselectnode = self.tree.OnSelectNode self.tree.selectednode = self + if onselectnode then + onselectnode(self.parent, self) + end end end diff --git a/objects/tree.lua b/objects/tree.lua index 81fe06e..418f4f4 100644 --- a/objects/tree.lua +++ b/objects/tree.lua @@ -26,6 +26,7 @@ function newobject:initialize() self.hbar = false self.internal = false self.selectednode = false + self.OnSelectNode = nil self.children = {} self.internals = {}