[tekui-devel] tekui: Several fixes to make menus and popups fully functional a...
Timm S. Mueller
tmueller at neoscientists.org
Wed Mar 19 18:41:01 CET 2008
details: http://hg.teklib.org/tekui/rev/f99f27868aef
changeset: 371:f99f27868aef
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Wed Mar 19 00:19:51 2008 +0100
description:
Several fixes to make menus and popups fully functional again; added "LeftUp"
notification in Window as an intermediate solution
diffs (truncated from 140 to 100 lines):
diff -r 3076b44d4a47 -r f99f27868aef tek/class/ui/group.lua
--- a/tek/class/ui/group.lua Tue Mar 18 22:21:41 2008 +0100
+++ b/tek/class/ui/group.lua Wed Mar 19 00:19:51 2008 +0100
@@ -99,7 +99,7 @@ function Group.newTabGroup(class, self)
IBorder = DEF_TABBORDER,
Margin = DEF_TABGROUPMARGIN,
Label = label,
- Mode = "toggle",
+ Mode = "touch",
HMax = false,
Notifications = {
["Pressed"] = {
diff -r 3076b44d4a47 -r f99f27868aef tek/class/ui/menuitem.lua
--- a/tek/class/ui/menuitem.lua Tue Mar 18 22:21:41 2008 +0100
+++ b/tek/class/ui/menuitem.lua Wed Mar 19 00:19:51 2008 +0100
@@ -119,7 +119,7 @@ function MenuItem:submenu(val)
if popup then
-- hilite over baseitem while we have another open popup in menubar:
if val == true and popup ~= self then
- db.warn("*** have another popup open")
+ db.info("have another popup open")
self:beginPopup()
self:setValue("Selected", true)
end
diff -r 3076b44d4a47 -r f99f27868aef tek/class/ui/popitem.lua
--- a/tek/class/ui/popitem.lua Tue Mar 18 22:21:41 2008 +0100
+++ b/tek/class/ui/popitem.lua Wed Mar 19 00:19:51 2008 +0100
@@ -12,7 +12,7 @@ local ipairs = ipairs
local ipairs = ipairs
module("tek.class.ui.popitem", tek.class.ui.button)
-_VERSION = "PopItem 1.7"
+_VERSION = "PopItem 1.8"
-------------------------------------------------------------------------------
-- Constants and class data:
@@ -41,6 +41,8 @@ local NOTIFY_ONSELECT = { ui.NOTIFY_SELF
local NOTIFY_ONSELECT = { ui.NOTIFY_SELF, "selectPopup" }
local NOTIFY_ONUNSELECT = { ui.NOTIFY_SELF, "unselectPopup" }
+local NOTIFY_ONRELEASEITEM = { ui.NOTIFY_SELF, "setValue", "Pressed", false }
+
-------------------------------------------------------------------------------
-- Class implementation:
-------------------------------------------------------------------------------
@@ -70,6 +72,7 @@ function PopItem:connectGlobal(app, wind
self:addNotify("Selected", true, NOTIFY_ONSELECT)
self:addNotify("Selected", false, NOTIFY_ONUNSELECT)
else
+ self:addNotify("LeftUp", true, NOTIFY_ONRELEASEITEM)
self:addNotify("Pressed", false, NOTIFY_ONRELEASE)
end
end
@@ -85,6 +88,7 @@ function PopItem:disconnectGlobal()
self:remNotify("Hilite", ui.NOTIFY_ALWAYS, NOTIFY_SUBMENU)
else
self:remNotify("Pressed", false, NOTIFY_ONRELEASE)
+ self:remNotify("LeftUp", true, NOTIFY_ONRELEASEITEM)
end
Button.disconnectGlobal(self)
end
diff -r 3076b44d4a47 -r f99f27868aef tek/class/ui/popradioitem.lua
--- a/tek/class/ui/popradioitem.lua Tue Mar 18 22:21:41 2008 +0100
+++ b/tek/class/ui/popradioitem.lua Wed Mar 19 00:19:51 2008 +0100
@@ -12,12 +12,13 @@ local PopItem = ui.PopItem
local PopItem = ui.PopItem
local CheckMark = ui.CheckMark
local VectorImage = ui.VectorImage
+local RadioButton = ui.RadioButton
local Theme = ui.Theme
local ipairs = ipairs
local max = math.max
module("tek.class.ui.popradioitem", tek.class.ui.popitem)
-_VERSION = "PopRadioItem 0.1"
+_VERSION = "PopRadioItem 0.2"
-------------------------------------------------------------------------------
-- Constants & Class data:
@@ -180,16 +181,7 @@ end
-------------------------------------------------------------------------------
function PopRadioItem:setSelected(onoff)
- PopItem.setSelected(self, onoff)
- if self.Selected then
- -- unselect siblings in group:
- local myclass = self:getClass()
- for _, e in ipairs(self:getParent().Children) do
- if e:getClass() == myclass and e.Selected and e ~= self then
- e:setValue("Selected", false)
- end
- end
- end
+ RadioButton.switch(self)
if self.PopupBase and self.PopupBase:getClass() == PopRadioItem then
-- if self.PopupBase and self.PopupBase ~= self then
self.PopupBase:setValue("Label", self.Label)
diff -r 3076b44d4a47 -r f99f27868aef tek/class/ui/window.lua
--- a/tek/class/ui/window.lua Tue Mar 18 22:21:41 2008 +0100
+++ b/tek/class/ui/window.lua Wed Mar 19 00:19:51 2008 +0100
More information about the tekui-devel
mailing list