changeset 59:c7330bc4a9ea

Escape button impl. Disabled for the moment
author John@Yosemite-PC
date Sun, 25 Mar 2012 17:43:31 -0400
parents 615346b6ee99
children dcf7c835d0a7
files Gui.lua
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Gui.lua	Sun Mar 25 17:43:09 2012 -0400
+++ b/Gui.lua	Sun Mar 25 17:43:31 2012 -0400
@@ -62,12 +62,24 @@
     end
     t1:SetList(tree)
 end
+local f
+local escapeButton = 
+{
+    shown = false,
+    ["IsShown"] = function(self) return self.shown end,
+    ["Hide"] = function(self) if f then bsk.print("Release!");AceGUI:Release(f); self.shown=false end end
+}
 
 function CreateGUI()
+    -- special registration procedure to be closable with the escape button
+    --escapeButton.shown = true
+    --_G["BSK_ESCAPEBUTTON"] = escapeButton
+    --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON")
+
     local admin = bsk.admin
-    local f = AceGUI:Create("Frame")
+    f = AceGUI:Create("Frame")
 
-    f:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end)
+    f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget) end)
     f:SetTitle("BSK")
     f:SetLayout("Flow")
     f:SetHeight(680)