[tekui-devel] tekui: Improved and simplified examples; Some corrections in the...

Timm S. Mueller tmueller at schulze-mueller.de
Sat Mar 28 23:02:44 CET 2009


details:   http://hg.teklib.org/tekui/rev/a734e695213f
changeset: 67:a734e695213f
user:      Timm S. Mueller <tmueller at schulze-mueller.de>
date:      Sat Mar 28 22:56:35 2009 +0100
description:
Improved and simplified examples; Some corrections in the documentation and
catalogs; 'Button' class added; Attributes 'ForceInteger' renamed to
'Integer', 'EraseBackground' to 'EraseBG', 'SelectedEntry' to 'SelectedLine',
'ThemeName' to 'Theme', 'FontSpec' to 'Font', removed attributes 'SameWidth'
and 'SameHeight'; Canvas: now derived from Frame, implements a Margin and
Border (but not Padding); DirList: minor corrections for better scalability;
FloatText: Corrected and improved, now supporting a Margin; PopList, Theme:
Added 'poplist-canvas' class; ScrollGroup: minsize calculation for automatic
scrollbars now considers margins and borders; ListView: mouse coordinates were
not correctly shifted into child canvas, minor visual improvements, some
cleanup; Group:addMember() did not connect the element, corrected; ListView,
PageGroup, Theme, stylesheet: corrected internal style class names to
"_listview-headitem" and "_pagegroup-container"; TextInput: Changed background
color; Default Border, Visual/Lua: Improved rendering speed; Application:
newsize (geometry-changing) messages are now dispatched prior to and
seperately from all other kinds of messages; Area: Grow+Move case did not
cause a redraw; Visual/Lua: Potential double free of message ports in
closedown procedure corrected; Default Border, Visual/Lua: Improved rendering
speed; Application: newsize (geometry-changing) messages are now dispatched
prior to and seperately from all other kinds of messages; Area: Grow+Move case
did not cause a redraw, corrected

diffs (truncated from 3877 to 100 lines):

diff -r ec76f313013a -r a734e695213f README
--- a/README	Tue Mar 24 12:00:46 2009 +0100
+++ b/README	Sat Mar 28 22:56:35 2009 +0100
@@ -408,12 +408,11 @@
     },
   }:run()
 
-When overwriting a method like {{onPress}} in an instance of its
-class, also forward the call to the original implementation of the
-same method; in the example above, this is accomplished by the last
-line in the {{onPress}} function.
+When overwriting a method like {{onPress}}, also forward the call to
+the original implementation of the same method; in the example above,
+this is accomplished by the last line in the {{onPress}} function.
 
-Another, more elobarate way is to equip the element with a
+A different, more elobarate way is to equip the element with a
 notification handler, which would look like this:
 
   ...
@@ -442,9 +441,11 @@
   ...
 
 Even though notification handlers can be written in the same
-expression as the rest of the application, we are now switching
-to a more dynamic kind of setup, because the deep levels of
-recursion are starting to interfere with clarity:
+expression as the rest of the application, this is not always
+recommendable, as the deep levels of indentation are easily
+getting in the way of clarity. Notification handlers are commonly
+added using the {{addNotify()}} method, as shown in the next
+example:
 
   #/usr/bin/env lua
   ui = require "tek.ui"
diff -r ec76f313013a -r a734e695213f bin/bashing.lua
--- a/bin/bashing.lua	Tue Mar 24 12:00:46 2009 +0100
+++ b/bin/bashing.lua	Sat Mar 28 22:56:35 2009 +0100
@@ -8,7 +8,7 @@
 	{
 		ui.Window:new
 		{
-			GridWidth = 2,
+			Columns = 2,
 			Children =
 			{
 				ui.Tunnel:new { MaxWidth = 400, MaxHeight = 200, VAlign = "bottom" },
diff -r ec76f313013a -r a734e695213f bin/demo.lua
--- a/bin/demo.lua	Tue Mar 24 12:00:46 2009 +0100
+++ b/bin/demo.lua	Sat Mar 28 22:56:35 2009 +0100
@@ -31,11 +31,16 @@
 	local demos = { }
 
 	for fname in lfs.readdir(ui.ProgDir) do
-		if fname:match("^demo_.*") then
+		if fname:match("^demo_.*%.lua$") then
 			fname = ui.ProgDir .. "/" .. fname
 			db.info("Loading demo '%s' ...", fname)
 			local success, res = pcall(dofile, fname)
 			if success then
+				local window = res.Window
+				window:addNotify("Status", "show", { ui.NOTIFY_ID,
+					window.Id .. "-button", "setValue", "Selected", true })
+				window:addNotify("Status", "hide", { ui.NOTIFY_ID,
+					window.Id .. "-button", "setValue", "Selected", false })
 				table.insert(demos, res)
 			else
 				db.error("*** Error loading demo '%s'", fname)
@@ -71,16 +76,6 @@
 --	Application:
 -------------------------------------------------------------------------------
 
-local QuitNotification =
-{
-	ui.NOTIFY_APPLICATION, ui.NOTIFY_COROUTINE, function(self)
-		if self:easyRequest(false, L.CONFIRM_QUIT_APPLICATION,
-			L.QUIT, L.CANCEL) == 1 then
-			self:setValue("Status", "quit")
-		end
-	end
-}
-
 app = ui.Application:new
 {
 	ProgramName = "tekUI Demo",
@@ -88,7 +83,6 @@
 	Copyright = "Copyright © 2008, 2009, Schulze-Müller GbR",
 	ApplicationId = APP_ID,
 	VendorDomain = VENDOR,
-	-- ThemeName = "internal",
 	Children =
 	{
 		ui.Window:new
@@ -143,24 +137,6 @@
 			Id = "about-window",
 			Status = "hide",
 			Title = L.ABOUT_TEKUI,
-			Notifications =
-			{
-				["Status"] =


More information about the tekui-devel mailing list