[tekui-devel] tekui: FloatText:appendLine() added; RadioButton, CheckMark: upd...

Timm S. Mueller tmueller at schulze-mueller.de
Thu Nov 13 03:25:07 CET 2008


details:   http://hg.teklib.org/tekui/rev/d6f7d2086646
changeset: 34:d6f7d2086646
user:      Timm S. Mueller <tmueller at schulze-mueller.de>
date:      Wed Nov 12 20:23:09 2008 +0100
description:
FloatText:appendLine() added; RadioButton, CheckMark: updated looks;
ScrollGroup: improved resize/repositioning logic; improved Choices demo

diffs (truncated from 731 to 100 lines):

diff -r 54f8949eff61 -r d6f7d2086646 bin/choices.lua
--- a/bin/choices.lua	Sat Nov 08 01:15:29 2008 +0100
+++ b/bin/choices.lua	Wed Nov 12 20:23:09 2008 +0100
@@ -7,6 +7,33 @@ local VENDOR = "schulze-mueller.de"
 
 local L = ui.getLocale(APP_ID, VENDOR)
 
+-------------------------------------------------------------------------------
+
+local VerboseCheckMark = ui.CheckMark:newClass { _NAME = "_vbcheckmark" }
+
+function VerboseCheckMark:onSelect(selected)
+	local tw = self.Application:getElementById("text-window")
+	local text = selected and L.ORDER or L.REVOKE
+	text = text .. ": " .. self.Text:gsub("_", "")
+	tw:appendLine(text, true)
+	ui.CheckMark.onSelect(self, selected)
+end
+
+-------------------------------------------------------------------------------
+
+local VerboseRadioButton = ui.RadioButton:newClass { _NAME = "_vbradiobutton" }
+
+function VerboseRadioButton:onSelect(selected)
+	if selected == true then
+		local tw = self.Application:getElementById("text-window")
+		local text = L.IMPRESSED .. ": " .. self.Text:gsub("_", "")
+		tw:appendLine(text, true)
+	end
+	ui.RadioButton.onSelect(self, selected)
+end
+
+-------------------------------------------------------------------------------
+
 ui.Application:new
 {
 	ApplicationId = APP_ID,
@@ -15,48 +42,112 @@ ui.Application:new
 	{
 		ui.Window:new
 		{
-			Width = "auto",
+			Title = L.CHOICES,
 			Height = "auto",
-			Title = L.CHOICES,
-			Legend = L.CHOICES,
-			SameSize = true,
 			Children =
 			{
 				ui.Group:new
 				{
-					Orientation = "vertical",
-					Legend = L.ORDER_BEVERAGES,
+					Width = "auto",
+					Legend = L.CHOICES,
+					SameSize = true,
 					Children =
 					{
-						ui.CheckMark:new { Text = L.CHOICE_WATER },
-						ui.CheckMark:new { Text = L.CHOICE_JUICE, Disabled = true },
-						ui.CheckMark:new { Text = L.CHOICE_MILK },
-						ui.Spacer:new { },
-						ui.CheckMark:new { Text = L.CHOICE_TEA },
-						ui.CheckMark:new { Text = L.CHOICE_COFFEE },
-						ui.Spacer:new { },
-						ui.CheckMark:new { Text = L.CHOICE_BEER },
-						ui.CheckMark:new { Text = L.CHOICE_WINE },
-					},
+						ui.Group:new
+						{
+							Orientation = "vertical",
+							Legend = L.ORDER_BEVERAGES,
+							Children =
+							{
+								VerboseCheckMark:new
+								{
+									Text = L.CHOICE_WATER
+								},
+								VerboseCheckMark:new
+								{
+									Text = L.CHOICE_JUICE,
+									Disabled = true
+								},
+								VerboseCheckMark:new
+								{
+									Text = L.CHOICE_MILK
+								},
+								ui.Spacer:new { },
+								VerboseCheckMark:new
+								{
+									Text = L.CHOICE_TEA
+								},
+								VerboseCheckMark:new
+								{
+									Text = L.CHOICE_COFFEE
+								},
+								ui.Spacer:new { },
+								VerboseCheckMark:new
+								{
+									Text = L.CHOICE_BEER


More information about the tekui-devel mailing list