[Orxonox-commit 2030] r6747 - code/trunk/data/gui/scripts

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Apr 16 15:01:07 CEST 2010


Author: rgrieder
Date: 2010-04-16 15:01:06 +0200 (Fri, 16 Apr 2010)
New Revision: 6747

Modified:
   code/trunk/data/gui/scripts/GUISheet.lua
   code/trunk/data/gui/scripts/PickupInventory.lua
Log:
Added onShow and onHide as overridable methods to GUISheet.lua
and applied it in PickupInventory.lua.

Modified: code/trunk/data/gui/scripts/GUISheet.lua
===================================================================
--- code/trunk/data/gui/scripts/GUISheet.lua	2010-04-16 12:50:16 UTC (rev 6746)
+++ code/trunk/data/gui/scripts/GUISheet.lua	2010-04-16 13:01:06 UTC (rev 6747)
@@ -15,16 +15,28 @@
 function P:onLoad()
 end
 
+-- show function for the GUI
+function P:show()
+    self.window:show()
+    self.bVisible = true
+
+    self:onShow()
+end
+
+-- Override this function if you need to do work on show
+function P:onShow()
+end
+
 -- hide function for the GUI
 function P:hide()
     self.window:hide()
     self.bVisible = false
+
+    self:onHide()
 end
 
--- show function for the GUI
-function P:show()
-    self.window:show()
-    self.bVisible = true
+-- Override this function if you need to do work on hide
+function P:onHide()
 end
 
 function P:load()

Modified: code/trunk/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/trunk/data/gui/scripts/PickupInventory.lua	2010-04-16 12:50:16 UTC (rev 6746)
+++ code/trunk/data/gui/scripts/PickupInventory.lua	2010-04-16 13:01:06 UTC (rev 6747)
@@ -10,17 +10,12 @@
     carrierList = {}
 end
 
-function P.show()
-    P.window:show() -- TODO: Do this through parent...
-    P.bVisible = true 
-    
+function P.onShow()
     P.createInventory()
-
 end
 
-function P.hide()
+function P.onHide()
     P.cleanup()
-    
 end
 
 function P.update()




More information about the Orxonox-commit mailing list