[tekui-devel] tekui: README: Corrected/improved examples in tutorial; Area: ad...
Timm S. Mueller
tmueller at schulze-mueller.de
Wed Sep 10 14:57:26 CEST 2008
details: http://hg.teklib.org/tekui/rev/e14e91fabc50
changeset: 16:e14e91fabc50
user: Timm S. Mueller <tmueller at schulze-mueller.de>
date: Wed Sep 10 14:53:13 2008 +0200
description:
README: Corrected/improved examples in tutorial; Area: added EraseBackground
attribute; DirList: added missing locale string; PopItem: now collapses in
hide(), draw() now erasing background itself, corrected connectPopItems()
initialization with regard to keyboard shortcuts; PopList: now respects
KeepMinWidth attribute; Text: KeepMinWidth/Height is now handled in repeated
iterations of askMinMax; Theme, internal.css: default styles corrected,
scrollbars are now vertically aligned in their grid cells; corrected
installation of some catalog files; UI.prepareStyleSheet(): no longer
overwrites more specific properties (like border-bottom-width) with catch-many
properties (like border-width)
diffs (truncated from 742 to 100 lines):
diff -r a4f16e6cf651 -r e14e91fabc50 README
--- a/README Tue Sep 09 01:16:29 2008 +0200
+++ b/README Wed Sep 10 14:53:13 2008 +0200
@@ -335,7 +335,7 @@ The GUI version of the "Hello, World!" p
ui.Text:new
{
Text = "_Hello, World!",
- Style = "button",
+ Class = "button",
Mode = "button",
},
},
@@ -388,12 +388,13 @@ and to '''false''' when it is getting re
ui.Text:new
{
Text = "_Hello, World!",
- Style = "button",
+ Class = "button",
Mode = "button",
onPress = function(self, pressed)
if pressed == false then
print "Hello, World!"
end
+ ui.Text.onPress(self, pressed)
end,
},
},
@@ -401,14 +402,19 @@ and to '''false''' when it is getting re
},
}: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.
+
Another, more elobarate way is to equip the element with a
-notification handler yourself, which may look like this:
+notification handler, which would look like this:
...
ui.Text:new
{
Text = "_Hello, World!",
- Style = "button",
+ Class = "button",
Mode = "button",
Notifications =
{
@@ -431,7 +437,7 @@ notification handler yourself, which may
Even though notification handlers can be written in the same
expression as the rest of the application, we are now switching
-to a different setup style, because the deep levels of
+to a more dynamic kind of setup, because the deep levels of
recursion are starting to interfere with clarity:
#/usr/bin/env lua
@@ -440,7 +446,7 @@ recursion are starting to interfere with
win = ui.Window:new { Title = "Hello" }
text = ui.Text:new {
Text = "_Hello, World!",
- Style = "button",
+ Class = "button",
Mode = "button"
}
text:addNotify("Pressed", false, {
@@ -485,7 +491,7 @@ file. For example, to derive a button cl
local Button = ui.Text:newClass { _NAME = "_button" }
-By convention, ad-hoc classes can be named arbitrarily, but their
+By convention, ad-hoc classes may be named arbitrarily, but their
names should be prefixed with an underscore to distinguish them
from global classes.
@@ -493,7 +499,7 @@ initializations which turn a Text into a
initializations which turn a Text into a Button:
function Button.init(self)
- self.Style = "button"
+ self.Class = "button"
self.Mode = self.Mode or "button"
return ui.Text.init(self)
end
diff -r a4f16e6cf651 -r e14e91fabc50 bin/helloworld.lua
--- a/bin/helloworld.lua Tue Sep 09 01:16:29 2008 +0200
+++ b/bin/helloworld.lua Wed Sep 10 14:53:13 2008 +0200
@@ -16,20 +16,31 @@ ui.Application:new
Text = "_Hello, World!",
Class = "button",
Mode = "button",
- Notifications =
- {
- ["Pressed"] =
- {
- [false] =
- {
- { ui.NOTIFY_SELF, ui.NOTIFY_FUNCTION,
- function(self)
More information about the tekui-devel
mailing list