[tekui-devel] tekui: Text, MenuItem: Shortcut renamed to KeyCode; Text: no lon...

Timm S. Mueller tmueller at neoscientists.org
Thu May 15 00:08:31 CEST 2008


details:   http://hg.teklib.org/tekui/rev/f45c6d2f3b97
changeset: 493:f45c6d2f3b97
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Tue May 13 10:50:30 2008 +0200
description:
Text, MenuItem: Shortcut renamed to KeyCode; Text: no longer overwrites
existing KeyCode

diffs (96 lines):

diff -r b00afd00e46b -r f45c6d2f3b97 bin/tekui.lua
--- a/bin/tekui.lua	Tue May 13 10:30:57 2008 +0200
+++ b/bin/tekui.lua	Tue May 13 10:50:30 2008 +0200
@@ -27,7 +27,7 @@ ui.Application:new
 					Style = "menubar",
 					Children = {
 						ui.MenuItem:new {
-							Label = "File",
+							Label = "_File",
 							Children = {
 								ui.MenuItem:new { Label = "New" },
 								ui.Spacer:new { },
@@ -55,11 +55,11 @@ ui.Application:new
 								ui.MenuItem:new { Label = "Print" },
 								ui.Spacer:new { },
 								ui.MenuItem:new { Label = "Close" },
-								ui.MenuItem:new { Label = "Close all", Shortcut = "Shift+Ctrl+Q" },
+								ui.MenuItem:new { Label = "Close all", KeyCode = "Shift+Ctrl+Q" },
 								ui.Spacer:new { },
 								ui.MenuItem:new {
 									Label = "Quit",
-									Shortcut = "Ctrl+Q",
+									KeyCode = "Ctrl+Q",
 									Notifications =
 									{
 										["Pressed"] =
@@ -318,8 +318,9 @@ ui.Application:new
 							Width = "auto",
 							Children =
 							{
-								ui.text:new { Mode = "button", Label = "Eins", Width = "fill" },
-								ui.text:new { Mode = "button", Label = "Zweidrei", Width = "fill" },
+								ui.CheckMark:new { Label = "_One" },
+								ui.RadioButton:new { Label = "T_wo" },
+								ui.RadioButton:new { Label = "T_hree" },
 							},
 						},
 						ui.text:new { Mode = "button", Label = "Open", VAlign = "center", Width = "auto" },
diff -r b00afd00e46b -r f45c6d2f3b97 tek/class/ui/menuitem.lua
--- a/tek/class/ui/menuitem.lua	Tue May 13 10:30:57 2008 +0200
+++ b/tek/class/ui/menuitem.lua	Tue May 13 10:50:30 2008 +0200
@@ -14,7 +14,7 @@ local floor = math.floor
 local floor = math.floor
 
 module("tek.class.ui.menuitem", tek.class.ui.popitem)
-_VERSION = "MenuItem 1.22"
+_VERSION = "MenuItem 1.23"
 
 -------------------------------------------------------------------------------
 --	Constants and class data:
@@ -58,7 +58,7 @@ function MenuItem.init(self)
 	else
 		self.Mode = "button"
 	end
-	self.Shortcut = self.Shortcut or false
+	self.KeyCode = self.KeyCode or false
 	self.TextHAlign = "left"
 	return PopItem.init(self)
 end
@@ -98,10 +98,10 @@ function MenuItem:setupDisplay(display, 
 	end
 
 	if PopItem.setupDisplay(self, display, drawable) then
-		self:addTextRecord(self.Label, self.FontSpec, "left")
-		if self.Shortcut and self.Parent.Style ~= "menubar" and
+		self:setTextRecord(1, self.Label, self.FontSpec, "left")
+		if self.KeyCode and self.Parent.Style ~= "menubar" and
 			not self.Children then
-			self:addTextRecord(self.Shortcut, self.FontSpec, "left")
+			self:setTextRecord(2, self.KeyCode, self.FontSpec, "left")
 		end
 		return true
 	end
diff -r b00afd00e46b -r f45c6d2f3b97 tek/class/ui/text.lua
--- a/tek/class/ui/text.lua	Tue May 13 10:30:57 2008 +0200
+++ b/tek/class/ui/text.lua	Tue May 13 10:50:30 2008 +0200
@@ -17,7 +17,7 @@ local type = type
 local type = type
 
 module("tek.class.ui.text", tek.class.ui.gadget)
-_VERSION = "Text 4.0"
+_VERSION = "Text 4.1"
 
 -------------------------------------------------------------------------------
 --	Constants & Class data:
@@ -218,7 +218,9 @@ function Text:addTextRecord(...)
 function Text:addTextRecord(...)
 	local record, keycode = self:newTextRecord(...)
 	insert(self.TextRecords, record)
-	self.KeyCode = keycode or self.KeyCode
+	if keycode and not self.KeyCode then
+		self.KeyCode = keycode
+	end
 	return record, keycode
 end
 


More information about the tekui-devel mailing list