[tekui-devel] tekui: Gadget: keyboard codes are now added in setupDisplay() an...
Timm S. Mueller
tmueller at neoscientists.org
Thu May 15 00:08:39 CEST 2008
details: http://hg.teklib.org/tekui/rev/c596266cb989
changeset: 499:c596266cb989
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Wed May 14 10:08:54 2008 +0200
description:
Gadget: keyboard codes are now added in setupDisplay() and removed in
cleanupDisplay(), for activating them only when needed
diffs (81 lines):
diff -r 81e79fe4b08e -r c596266cb989 bin/demo.lua
--- a/bin/demo.lua Wed May 14 00:02:18 2008 +0200
+++ b/bin/demo.lua Wed May 14 10:08:54 2008 +0200
@@ -209,7 +209,7 @@ ui.Application:new
ui.text:new
{
Mode = "button",
- Label = "Start",
+ Label = "_Start",
Notifications =
{
["Pressed"] =
@@ -226,7 +226,7 @@ ui.Application:new
ui.text:new
{
Mode = "button",
- Label = "Stop",
+ Label = "St_op",
Notifications =
{
["Pressed"] =
diff -r 81e79fe4b08e -r c596266cb989 tek/class/ui/gadget.lua
--- a/tek/class/ui/gadget.lua Wed May 14 00:02:18 2008 +0200
+++ b/tek/class/ui/gadget.lua Wed May 14 10:08:54 2008 +0200
@@ -53,7 +53,7 @@ local Frame = ui.Frame
local Frame = ui.Frame
module("tek.class.ui.gadget", tek.class.ui.frame)
-_VERSION = "Gadget 7.1"
+_VERSION = "Gadget 7.2"
local Gadget = _M
@@ -96,9 +96,6 @@ end
-------------------------------------------------------------------------------
function Gadget:connectGlobal(app, window)
- if self.KeyCode then
- window:addKeyShortcut(self.KeyCode, self)
- end
Frame.connectGlobal(self, app, window)
self:addNotify("Disabled", ui.NOTIFY_CHANGE, NOTIFY_DISABLED)
self:addNotify("Hilite", ui.NOTIFY_CHANGE, NOTIFY_HILITE)
@@ -113,9 +110,6 @@ end
-------------------------------------------------------------------------------
function Gadget:disconnectGlobal()
- if self.KeyCode then
- self.Window:remKeyShortcut(self.KeyCode, self)
- end
self:remNotify("Pressed", ui.NOTIFY_CHANGE, NOTIFY_PRESSED)
self:remNotify("Active", ui.NOTIFY_CHANGE, NOTIFY_ACTIVE)
self:remNotify("Hover", ui.NOTIFY_CHANGE, NOTIFY_HOVER)
@@ -130,6 +124,9 @@ end
-------------------------------------------------------------------------------
function Gadget:setupDisplay(display, drawable)
+ if self.KeyCode then
+ self.Window:addKeyShortcut(self.KeyCode, self)
+ end
local theme = display.Theme
-- outer spacing:
self.Margin = self.Margin or theme.GadgetMargin or false
@@ -145,6 +142,17 @@ function Gadget:setupDisplay(display, dr
self.IBorderStyle = self.IBorderStyle or theme.GadgetIBorderStyle or
DEF_IBORDERSTYLE
return Frame.setupDisplay(self, display, drawable)
+end
+
+-------------------------------------------------------------------------------
+-- cleanupDisplay:
+-------------------------------------------------------------------------------
+
+function Gadget:cleanupDisplay()
+ Frame.cleanupDisplay(self)
+ if self.KeyCode then
+ self.Window:remKeyShortcut(self.KeyCode, self)
+ end
end
-------------------------------------------------------------------------------
More information about the tekui-devel
mailing list