[tekui-devel] tekui: Sudoku: bug fixed; Text: slightly optimized

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


details:   http://hg.teklib.org/tekui/rev/6ce6df7e7aa0
changeset: 495:6ce6df7e7aa0
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Tue May 13 12:49:16 2008 +0200
description:
Sudoku: bug fixed; Text: slightly optimized

diffs (49 lines):

diff -r 9a008db0c1e2 -r 6ce6df7e7aa0 bin/sudoku.lua
--- a/bin/sudoku.lua	Tue May 13 11:24:23 2008 +0200
+++ b/bin/sudoku.lua	Tue May 13 12:49:16 2008 +0200
@@ -125,7 +125,7 @@ function sudokubutton:onRelease()
 		if n >= 10 then
 			n = nil
 		end
-		self:setValue("Label", n and tostring(n))
+		self:setValue("Label", n and tostring(n) or "")
 		self.Application:modify()
 	end
 end
diff -r 9a008db0c1e2 -r 6ce6df7e7aa0 tek/class/ui/text.lua
--- a/tek/class/ui/text.lua	Tue May 13 11:24:23 2008 +0200
+++ b/tek/class/ui/text.lua	Tue May 13 12:49:16 2008 +0200
@@ -17,7 +17,7 @@ local type = type
 local type = type
 
 module("tek.class.ui.text", tek.class.ui.gadget)
-_VERSION = "Text 5.0"
+_VERSION = "Text 5.1"
 
 -------------------------------------------------------------------------------
 --	Constants & Class data:
@@ -215,12 +215,7 @@ end
 -------------------------------------------------------------------------------
 
 function Text:addTextRecord(...)
-	local record, keycode = self:newTextRecord(...)
-	insert(self.TextRecords, record)
-	if keycode and not self.KeyCode then
-		self.KeyCode = keycode
-	end
-	return record, keycode
+	return self:setTextRecord(#self.TextRecords + 1, ...)
 end
 
 -------------------------------------------------------------------------------
@@ -230,7 +225,9 @@ function Text:setTextRecord(pos, ...)
 function Text:setTextRecord(pos, ...)
 	local record, keycode = self:newTextRecord(...)
 	self.TextRecords[pos] = 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