[tekui-devel] tekui: PopItem: fixed missing input handler for mouseover messag...
Timm S. Mueller
tmueller at neoscientists.org
Tue Apr 1 15:36:30 CEST 2008
details: http://hg.teklib.org/tekui/rev/b10f76c7c79a
changeset: 400:b10f76c7c79a
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Mon Mar 31 22:15:11 2008 +0200
description:
PopItem: fixed missing input handler for mouseover messages; UI, PopItem,
TextInput, Window: Message types are now available symbolically
diffs (truncated from 229 to 100 lines):
diff -r f78f2dd12cdd -r b10f76c7c79a tek/class/ui/popitem.lua
--- a/tek/class/ui/popitem.lua Mon Mar 31 21:33:06 2008 +0200
+++ b/tek/class/ui/popitem.lua Mon Mar 31 22:15:11 2008 +0200
@@ -12,7 +12,7 @@ local ipairs = ipairs
local ipairs = ipairs
module("tek.class.ui.popitem", tek.class.ui.text)
-_VERSION = "PopItem 1.14"
+_VERSION = "PopItem 1.15"
-------------------------------------------------------------------------------
-- Constants and class data:
@@ -158,18 +158,6 @@ function PopItem:beginPopup()
self.PopupWindow = ui.Window:new
{
- handleMouseOverMsg = function(self, msg)
- if msg[3] == 0 then
- if self.DelayedEndPopup then
- self:setHoverElement(self.DelayedEndPopup)
- self.DelayedEndPopup = false
- end
- end
- -- intercept and do not pass control back to window msg handler:
- return msg
- -- return ui.window.handleMouseOverMsg(self, msg)
- end,
-
BackPen = ui.PEN_MENUBACK,
Margin = theme.PopupMargin or DEF_POPUPMARGIN,
Border = theme.PopupBorder or DEF_POPUPBORDER,
@@ -181,15 +169,21 @@ function PopItem:beginPopup()
WinHeight = winh,
MaxWidth = 0,
MaxHeight = 0,
-
- -- temporarily adopt children:
- Children = self.Children,
-
- TickCount = 0,
-
+ Children = self.Children, -- temporarily adopt children
+ TickCount = 0
}
- self.PopupWindow:addInputHandler(2048, function(self, msg)
+ self.PopupWindow:addInputHandler(ui.MSGTYPE_MOUSEOVER, function(self, msg)
+ if msg[3] == 0 then
+ if self.DelayedEndPopup then
+ self:setHoverElement(self.DelayedEndPopup)
+ self.DelayedEndPopup = false
+ end
+ end
+ -- do not pass control back to window msg handler
+ end)
+
+ self.PopupWindow:addInputHandler(ui.MSGTYPE_INTERVAL, function(self, msg)
self.TickCount = self.TickCount - 1
if self.TickCount < 0 then
if self.DelayedBeginPopup then
diff -r f78f2dd12cdd -r b10f76c7c79a tek/class/ui/textinput.lua
--- a/tek/class/ui/textinput.lua Mon Mar 31 21:33:06 2008 +0200
+++ b/tek/class/ui/textinput.lua Mon Mar 31 22:15:11 2008 +0200
@@ -16,7 +16,7 @@ local unpack = unpack
local unpack = unpack
module("tek.class.ui.textinput", tek.class.ui.text)
-_VERSION = "TextInput 1.16"
+_VERSION = "TextInput 1.17"
-------------------------------------------------------------------------------
-- Constants & Class data:
@@ -233,11 +233,11 @@ function TextInput:select(onoff)
priv.Editing = true
self.Window:addNotify("Interval", ui.NOTIFY_ALWAYS, self.IntervalNotify)
self:addNotify("BlinkState", ui.NOTIFY_ALWAYS, NOTIFY_REDRAW)
- self.Window:addInputHandler(256, TextInput.handleKeyDownMsg)
+ self.Window:addInputHandler(ui.MSGTYPE_KEYDOWN, TextInput.handleKeyDownMsg)
self:onPress()
elseif not onoff and priv.Editing then
priv.Editing = false
- self.Window:remInputHandler(256, TextInput.handleKeyDownMsg)
+ self.Window:remInputHandler(ui.MSGTYPE_KEYDOWN, TextInput.handleKeyDownMsg)
self.Window:remNotify("Interval", ui.NOTIFY_ALWAYS, self.IntervalNotify)
self:remNotify("BlinkState", ui.NOTIFY_ALWAYS, NOTIFY_REDRAW)
end
diff -r f78f2dd12cdd -r b10f76c7c79a tek/class/ui/window.lua
--- a/tek/class/ui/window.lua Mon Mar 31 21:33:06 2008 +0200
+++ b/tek/class/ui/window.lua Mon Mar 31 22:15:11 2008 +0200
@@ -62,16 +62,16 @@ function Window.init(self)
self.HoverElement = false
self.InputHandlers =
{
- [1] = { }, -- close
- [2] = { }, -- focus
- [4] = { }, -- newsize
- [8] = { }, -- refresh
- [16] = { }, -- mouseover
- [256] = { }, -- keydown
- [512] = { }, -- mousemove
More information about the tekui-devel
mailing list