Class (v7.0)
ClassOverview : Class
This module implements inheritance and the creation of objects from classes.
- Class:getClass() - Returns the class of an object, or the super class of a class
- Class:getClassName() - Returns the class name of an object or class
- Class:getSuper() - Returns the super class of an object or class
- Class:instanceOf() - Checks if an object descends from a class
- Class.new() - Creates and returns a new object
- Class.newClass() - Creates a child class from a super class
- Class:setClass() - Changes the class of an object, or the super class of a class
class = object:getClass()
This function returns the class of an object. If applied to a
class instead of an object, it returns its super class, e.g.:
superclass = Class.getClass(class)
name = object:getClassName()
This function returns the _NAME
attribute of the object's class. It is also possible to apply this
function to a class instead of an object.
object:getSuper()
Gets the super class of an object or class.
For example, to forward a call to a method to its super class,
without knowing its class:
self:getSuper().method(self, ...)
is_descendant = object:instanceOf(class)
Returns true if object is an instance of or descends from the
specified class. It is also possible to apply this function to a class
instead of an object, e.g.:
Class.instanceOf(Button, Area)
object = Class.new(class[, object])
Creates and returns a new object of the given class. Optionally,
it just prepares the specified object (a table) for inheritance and
attaches the class' methods and data.
class = Class.newClass(superclass[, class])
Derives a new class from the specified superclass. Optionally,
an existing class (a table) can be specified. If a _NAME field
exists in this class, it will be used. Otherwise, or if a new class is
created, class._NAME will be composed from superclass._NAME and
an unique identifier. The same functionality can be achieved by calling
a class like a function, so the following invocations are equivalent:
class = Class.newClass(superclass) class = superclass()
The second notation allows a super class to be passed as the second
argument to Lua's module function, which will set up a child class
inheriting from superclass in the module table.
List (v3.1)
ClassOverview : Class / List
This class implements a list container.
- List:addItem() - Adds an item to the list
- List:changeItem() - Replaces an item in the list
- List:clear() - Removes all items from the list
- List:getItem() - Returns the item at the specified position
- List:getN() - Returns the number of items in the list
- List:remItem() - Removes an item from the list
Items[I] (table)Table of initial list items, indexed numerically
pos = List:addItem(entry[, pos])
Adds an item to the list, optionally inserting it at the specified position. Returns the position at which the item was added.
success = List:changeItem(entry, pos)
Changes the item at the specified position in the list. Returns true if an item was changed.
entry = List:remItem(pos)
Removes an item at the specified position in the list. The item is returned to the caller.
Markup (v3.2)
ClassOverview : Class / Markup
This class implements a markup parser and converter for producing feature-rich XHTML 1.0 from plain text with special formattings.
parser = Markup:new(args)
Creates a new markup parser. args can be a
table of initial arguments that constitute its behavior. Supported fields
in args are:
indentchar
|
Character recognized for indentation, default "\t"
|
input
|
Filehandle or string, default io.stdin
|
rdfunc
|
Line reader, by default reads using args.input:lines
|
wrfunc
|
Writer func, by default io.stdout.write
|
docname
|
Name of document, default "Manual"
|
features
|
Feature codes, default "hespcadlint"
|
The parser supports the following features, which can be combined into
a string and passed to the constructor in args.features:
| Code | Description | rough HTML equivalent |
h
|
Heading |
<h1>, <h2>, ...
|
e
|
Emphasis |
<strong>
|
s
|
Separator |
<hr>
|
p
|
Preformatted block |
<pre>
|
c
|
Code |
<code>
|
a
|
Anchor, link |
<a href="...">
|
d
|
Definition |
<dfn>
|
l
|
List |
<ul>, <li>
|
i
|
Image |
<img>
|
n
|
Node header |
<a name="...">
|
t
|
Table |
<table>
|
f
|
Function | (undocumented, internal use only) |
After creation of the parser, conversion starts by calling Markup:run().
Object (v13.0)
ClassOverview : Class / Object
This class implements notifications.
- Object.addClassNotifications - Collects class notifications
- Object:addNotify() - Adds a notification to an object
- Object:doNotify() - Invokes a notification in the addressed object
- Object.init() - (Re-)initializes an object
- Object:remNotify() - Removes a notification from an object
- Object:setValue() - Sets an attribute, triggering notifications
Object.addClassNotifications(proto)
class method for collecting the class' 'standard' notifications. Standard means that these notifications remain in place, and are not removed or replaced during runtime.
Object:addNotify(attr, val, dest)
Adds a notification to an object. attr is the name of an attribute to
react on setting its value. val is the value that triggers the
notification. For val, the placeholder ui.NOTIFY_ALWAYS can be
used to react on any change of the value.
action is a table describing the action to take when the
notification occurs; it has the general form:
{ object, method, arg1, ... }
object denotes the target of the notification, i.e. the self
that will be passed to the method as its first argument.
ui.NOTIFY_SELF is a placeholder for the object causing the
notification (see below for the additional placeholders ui.NOTIFY_ID,
ui.NOTIFY_WINDOW, and ui.NOTIFY_APPLICATION). method can be
either a string denoting the name of a function in the addressed object,
or ui.NOTIFY_FUNCTION followed by a function value. The following
placeholders are supported in the Object class:
ui.NOTIFY_SELF- the object causing the notificationui.NOTIFY_VALUE- the value causing the notificationui.NOTIFY_TOGGLE- the logical negation of the valueui.NOTIFY_OLDVALUE- the attributes's value prior to setting itui.NOTIFY_FORMAT- taking the next argument as a format string for formatting the valueui.NOTIFY_FUNCTION- to pass a function in the next argument
The following additional placeholders are supported if the notification is triggered in a child of the Element class:
ui.NOTIFY_ID- to address the Element with the Id given in the next argumentui.NOTIFY_WINDOW- to address the Window the object is connected toui.NOTIFY_APPLICATION- to address the Application the object is connected toui.NOTIFY_COROUTINE- likeui.NOTIFY_FUNCTION, but the function will be launched as a coroutine by the Application. See also Application:addCoroutine() for further details.
In any case, the method will be invoked as follows:
method(object, arg1, ...)
If the destination object or addressed method cannot be determined, nothing else besides setting the attribute will happen.
Notifications should be removed using Object:remNotify() when they are no longer needed, to reduce overhead and memory use.
Object:doNotify(func, ...)
Performs a notification in the object by
calling the specified function and passing it the given arguments. If
func is a a function value, it will be called directly. Otherwise, it
will be used as a key for looking up the function.
object = Object.init(object)
This function is called during Object.new()
before passing control to superclass.new(). By convention, new()
is used to claim resources (e.g. to create tables), whereas the init()
function is used to initialize them with defaults.
success = Object:remNotify(attr, val, dest)
Removes a notification from an object and returns true if it was found and removed successfully. You must specify the exact set of arguments as for Object:addNotify() to identify a notification for removal.
Object:setValue(key, value[, notify])
Sets an object's key to
the specified value, and, if notify is not false, triggers
notifications that were previously registered with the object. If
value is nil, the key's present value is reset. To enforce a
notification regardless of its value, set notify to true.
For details on registering notifications, see Object:addNotify().
UTF8String (v3.1)
ClassOverview : Class / UTF8String
This class supports the manipulation of UTF-8 encoded strings.
- UTF8String:byte() - Returns Unicode character codes
- UTF8String.char() - Returns UTF8-encoded character sequences
- UTF8String.chars() - Iterator over a string's Unicode character codes
- UTF8String:erase() - Removes substring
- UTF8String:find() - Find an UTF-8-encoded string
- UTF8String:get() - Returns the string in UTF-8 encoded form
- UTF8String:insert() - Inserts a string at a given position
- UTF8String:len() - Returns the length in characters
- UTF8String:overwrite() - Overwrites string
- UTF8String:set() - Sets a string
- UTF8String:sub() - Returns a substring of a string
- UTF8String.new() - Creates an UTF-8 string object from a string
UTF8String:byte(i[, j])
Equivalent to string.byte(), except for that
it may return characters in the Unicode range.
UTF8String.char(...)
Equivalent to string.char(), except for that it
accepts character codes in the Unicode range.
UTF8String.chars(utf8)
Returns an iterator that traverses the characters in an UTF-8 encoded string, returning character codes in the Unicode range (up to 31 bit). Example:
for pos, char in UTF8String.chars(utf8str) do
...
end
UTF8String:erase(i[, j])
Erases the characters at the positions from
i to j. The semantics for the range are the same as for
UTF8String:sub().
start, end = UTF8String:find(findstr[, pos])
Find the specified (UTF-8
encoded) findstring in the string object, optionally starting at the
given position. Returns the starting and ending position where the strings
match in the string object, or nil.
UTF8String:insert(string[, position])
Inserts the UTF-8 encoded string
at the specified position to the string object. If position is
absent, the string is added to the end.
string = UTF8String.new(class, string)
Creates a string object from an (already UTF-8 encoded) regular string.
UTF8String:overwrite(s[, pos])
Overwrites the string object with the specified (already UTF-8 encoded) string, starting a the given position.
substring = UTF8String:sub(i[, j])
Returns an UTF-8 encoded substring.
The semantics are the same as for string.sub().
args (v2.3)
This library implements an argument parser.
A string is parsed into an array of arguments according to a format template. Arguments in the template are separated by commas. Each argument in the template consists of a keyword, optionally followed by one or more aliases delimited by equal signs, and an optional set of modifiers delimited by slashes. Modifiers denote the expected data type, if the argument is mandatory and whether a keyword must precede its value to form a valid argument. Example argument template:
SOURCE=-s/A/M,DEST=-d/A/KThis template requires one or more arguments to satisfy
SOURCE, and exactly one argument to satisfyDEST. Neither can be omitted. Either-d(or its aliasDEST) must precede the value to be accepted as the second argument. Example command lines:
SOURCE one two three DEST foovalid DEST foo -s onevalid DEST foorejected; source argument missing one two three foorejected; keyword missing one two dest foovalid, keys are case insensitive one two three -d="foo" fourvalid, "four" added to SOURCEAn option without modifiers represents an optional string argument. Available modifiers are:
/S- Switch; considered a boolean value. When the keyword is present, true will be written into the respective slot in the results array./N- Number; the value will be converted to a number./K- Keyword; the keyword (or an alias) must precede its value./A- Always required; This argument cannot be omitted./M- Multiple; Any number of strings will be accepted, and all values that cannot be assigned to other arguments will show up in this argument. No more than one/Mmodifier may appear in a template./F- Fill; literal rest of line. If present, this must be the last argument.Quoting and escaping: Double quotes can be used to enclose arguments containing equal signs and spaces.
- args.read() - Parses a string or table through an argument template
Backslashes for escaping quotes, spaces and themselves
res, msg = args.read(template, args)
Parses args according to
template. args can be a string or a table of strings. If the
arguments can be successfully matched against the template, the result
will be a table of parsed arguments, indexed by both keywords and
numerical order in which they appear in template, and the second
argument will be set to the number of arguments in the template. If the
arguments cannot be matched against the template, the result will be
nil followed by an error message.
debug (v4.3)
Debug library - implements debug output and debug levels:
2 TRACE used for trace messages 4 INFO informational messages, notices 5 WARN something unexpected happened 10 ERROR something went wrong, e.g. resource unavailable 20 FAIL something went wrong that cannot be coped with The default debug level is
WARN. To set the debug level globally, e.g.:db = require "tek.lib.debug" db.level = db.INFOThe default debug output stream is
stderr. To override it globally, e.g.:db = require "tek.lib.debug" db.out = io.open("logfile", "w")
- debug.console() - Enters the debug console
- debug.dump() - Dumps a table recursively
- debug.error() - Prints a text in the
ERRORdebug level- debug.execute() - Executes a function in the specified debug level
- debug.fail() - Prints a text in the
FAILdebug level- debug.info() - Prints a text in the
INFOdebug level- debug.print() - Prints a text in the specified debug level
- debug.stacktrace() - Prints a stacktrace in the specified debug level
- debug.trace() - Prints a text in the
TRACEdebug level- debug.warn() - Prints a text in the
WARNdebug level- debug.wrout() - Output function
level- Debug level, default 5 (WARN)out- Output stream, defaultio.stderr
debug.dump(table[, outfunc])
Dumps a table as Lua source using
outfunc. Cyclic references are silently dropped. The default output
function is debug.wrout().
debug.execute(lvl, func, ...)
Executes the specified function if the global debug level is less or equal the specified level.
debug.print(lvl, msg, ...)
Prints formatted text if the global debug level is less or equal the specified level.
debug.stacktrace(debuglevel[, stacklevel])
Prints a stacktrace starting at
the function of the given level on the stack (excluding the
stracktrace function itself) if the global debug level is less
or equal the specified debuglevel.
Region (v10.0)
This library implements the management of regions, which are collections of non-overlapping rectangles.
- Region:andRect() - Ands a rectangle to a region
- Region:andRegion() - Ands a region to a region
- Region:checkIntersect() - Checks if a rectangle intersects a region
- Region:forEach() - Calls a function for each rectangle in a region
- Region.intersect() - Returns the intersection of two rectangles
- Region:isEmpty() - Checks if a Region is empty
- Region.new() - Creates a new Region
- Region:orRect() - Ors a rectangle to a region
- Region:orRegion() - Ors a region to a region
- Region:setRect() - Resets a region to the given rectangle
- Region:shift() - Displaces a region
- Region:subRect() - Subtracts a rectangle from a region
- Region:subRegion() - Subtracts a region from a region
- Region:xorRect() - Exclusive Ors a rectangle to a region
success = region:checkIntersect(x0, y0, x1, y1)
Returns a boolean indicating whether a rectangle specified by its coordinates overlaps with a region.
region:forEach(func, obj, ...)
For each rectangle in a region, calls the specified function according the following scheme:
func(obj, x0, y0, x1, y1, ...)
Extra arguments are passed through to the function.
x0, y0, x1, y1 = Region.intersect(d1, d2, d3, d4, s1, s2, s3, s4)
Returns the coordinates of a rectangle where a rectangle specified by the coordinates s1, s2, s3, s4 overlaps with the rectangle specified by the coordinates d1, d2, d3, d4. The return value is nil if the rectangles do not overlap.
ui (v34.0)
This module is the user interface toolkit's base library. It implements a class loader and support functions, and it provides a central place for various constants and defaults. To invoke the class loader, simply aquire a class from the
tek.uitable, e.g. this will load the tek.ui.class.application class, as well as all subsequently needed classes:local ui = require "tek.ui" ui.Application:new { ...
- ui.createHook() - Creates a hook object
- ui.destroyHook() - Destroys a hook object
- ui.getStockImage() - Gets a stock image object
- ui.extractKeyCode() - Extracts a keycode from a string
- ui.getLocale() - Gets a locale catalog
- ui.loadClass() - Loads a named class
- ui.loadImage() - Retrieves an image (possibly from an image cache)
- ui.loadLibrary() - Loads a library
- ui.loadStyleSheet() - Loads and parses a style sheet file
- ui.loadTable() - Loads a table from some standard path
- ui.require() - Loads an user interface class
- ui.resolveKeyCode() - Converts a keycode into keys and qualifiers
HUGE
- This constant is used to express a 'huge' spatial extent on a given axis, e.g.
Width = ui.HUGEindicates that you wish no specific size limit on the X axis.
DBLCLICKJITTER
- Maximum sum of squared delta mouse positions (dx² + dy²) for a pair of mouse clicks to be accepted as a double click. The default is
70. Large touchscreens may require a much larger value.DBLCLICKTIME
- Maximum number of microseconds between mouse clicks to be recognized as a double click. Default:
32000. Use a larger value for touchscreens.
MSG_CLOSE
- Message sent when a window was closed
MSG_FOCUS
- A window has been activated or deactivated
MSG_INTERVAL
- 50Hz Timer interval message
MSG_KEYDOWN
- Key pressed down
MSG_KEYUP
- Key released
MSG_MOUSEBUTTON
- Mousebutton pressed or released
MSG_MOUSEMOVE
- Mouse pointer moved
MSG_MOUSEOVER
- Mouse pointer has entered or left the window
MSG_NEWSIZE
- A window has been resized
MSG_REFRESH
- A window needs a (partial) refresh
MSG_USER
- User message
NOTIFY_ALWAYS- see ObjectNOTIFY_VALUE- see ObjectNOTIFY_TOGGLE- see ObjectNOTIFY_FORMAT- see ObjectNOTIFY_SELF- see ObjectNOTIFY_OLDVALUE- see ObjectNOTIFY_FUNCTION- see ObjectNOTIFY_WINDOW- see Object, defined in ElementNOTIFY_APPLICATION- see Object, defined in ElementNOTIFY_ID- see Object, defined in ElementNOTIFY_COROUTINE- see Object, defined in Element
hookobject = ui.createHook(realm, classname, parent[, table])
Loads a
class of the given realm and classname, instantiates it (optionally
passing it table for initialization), connects it to the specified
parent element, and calls its setup() method. If classname is
the pre-defined name "none", this function returns false. Refer
also to ui.loadClass() for further details.
false = ui.destroyHook([hookobject])
Destroys a hook object by invoking
its cleanup() and disconnect() methods. Always returns false.
ui.extractKeyCode(string[, shortcutmark])
Extract a shortcut character from a string. The default shortcut marker is an underscore.
catalog = ui.getLocale(appid[, vendordomain[, deflang[, language]]])
Returns a table of locale strings for the given application Id and vendor
domain. deflang (default: "en") is used as the default language
code if a catalog for the requested language is unavailable. If no
language code is specified, then the preferred language will be
obtained from the operating system or desktop environment. If no catalog
file was found or non-existent keys are used to access the resulting
catalog, the key will be echoed with underscores turned into spaces; for
example, if catalog contained no string for the given key, accessing
catalog.HELLO_WORLD would return the string "HELLO WORLD".
imgobject = ui.getStockImage(name, ...)
Creates an image object of a
named class, corresponding to classes found in tek/ui/image. Extra
arguments are passed on as imageclass:new(...).
properties, errmsg = ui.getStyleSheet([name])
Aquires a style sheet from memory, by loading it from disk, or by determining properties at runtime. Predefined names are:
"minimal"- the hardcoded internal user agent style sheet"desktop"- An external style sheet named "desktop.css", overlayed with the color scheme (and possibly other properties) of the running desktop (if applicable)
Any other name will cause this function to attempt to load an equally named style sheet file.
class = ui.loadClass(realm, classname[, min_version])
Loads a class of the given classname from the specified realm,
and optionally with a minimum version requirement.
Returns the loaded class or false if the class or realm is
unknown, if the version requirement cannot be satisfied, or if an error
occured in the module. Currently defined values for realm are:
"border"- border classes"class"- user interface element classes"hook"- drawing hook classes"image"- image classes"layout"- group layouting classes
imgobject = ui.loadImage(name)
Loads an image from a file or retrieves it from the image cache. Note that currently only the PPM file format is recognized.
ui.loadLibrary(name[, version])
Loads a library with at least the
specified major version, from a local or global path starting with
tek/lib.
properties, msg = ui.loadStyleSheet(file)
This function loads a style
sheet from the specified file (which can be a name or an open file handle),
and parses it into a table of style classes with properties. If parsing
failed, the return value is false and msg contains an error
message.
table, msg = ui.loadTable(fname)
This function tries to load a file from
the various possible locations as defined by ui.LocalPath, interpretes
it is as Lua source, and returns its contents as keys and values of a
table. If unsuccessful, returns nil followed by an error message.
ui.require(name[, version])
Loads an user interface class with at least
the specified major version. This function is a shortcut for
ui.loadClass("class", ...) - see ui.loadClass() for more details.
key, quals = ui.resolveKeyCode(code)
Resolves a combined keycode specifier
(e.g. "Ctrl+Shift+Q") into a key string and a table of qualifier codes.
Application (v32.1)
ClassOverview : Class / Family / Application
This class implements tekUI's application, entrypoint and main loop.
A tekUI application can be written in a single, nested expression:
local ui = require "tek.ui" ui.Application:new { Children = { ui.Window:new { Children = { ui.Button:new { Text = "Hello World" } } } } }:run()
ApplicationId [IG](string)Name of the application, normally used as an unique identifier in combination with the
Domainattribute. Default is"unknown".Author [IG](string)Names of the application's authors. Default:
"unknown"AuthorStyles [IG](string)A string containing style sheet notation, overlaying all other properties, including those retrieved using the
AuthorStyleSheetsattribute.AuthorStyleSheets [IG](string)A string containing the names of author style sheet files overlaying user and user agent styles. Multiple style sheets are separated by spaces. The last style sheet has the highest precedence, e.g.
"desktop texture"would load the style sheetsdesktop.cssandtexture.css, placingtexture.csson top of the cascade.Copyright [IG](string)Copyright notice applying to the application, default
"unknown"Display [IG](Display)An initial Display. By default, the application creates a new one during Application.new().
Domain [IG](string)An uniquely identifying domain name of the vendor, organization or author manufacturing the application (preferrably without domain parts like
"www."if they are not significant for identification). Default is"unknown".GCControl [IG](boolean or string)The application can perform a garbage collection of the specified type directly before getting suspended waiting for input. If set to false, no explicit garbage collection is initiated. If the value is true or
"step", the application performs a single garbage collection step. Other values (e.g."collect") are passed unmodified tocollectgarbage(). Default: trueProgramName [IG](string)Name of the application, as displayed to the user. This is also the fallback for the
Titleattribute in windows. If unset, the default will be"tekUI".Status [G](string)Status of the application, can be
"init","error","run","quit".Vendor [IG](string)Name of the vendor or organization responsible for producing the application, as displayed to the user. Default
"unknown".
The
DomainandApplicationIdattributes are UTF-8 encoded strings, so any international character sequence is valid for them. Anyhow, it is recommended to avoid too adventurous symbolism, as its end up in a hardly decipherable, UTF-8 plus URL-encoded form in the file system, e.g. for loading catalog files fromtek/ui/locale/<domain>/<applicationid>.
- Application:addCoroutine() - Adds a coroutine to the application
- Application:addInputHandler() - Adds input handler to the application
- Application:connect() - Connects children recursively
- Application:easyRequest() - Opens a message box
- Application:getById() - Returns an element by Id
- Application:getChildren() - Returns the application's children
- Application:getGroup() - Returns the application's group
- Application:getLocale() - Returns a locale for the application
- Application:quit() - Quits the application
- Application:remInputHandler() - Removes a registered input handler
- Application:requestFile() - Opens a file requester
- Application:run() - Runs the application
- Application:suspend() - Suspends the caller's coroutine
addCoroutine(function, arg1, ...)
Adds the specified function and arguments to the application as a new coroutine, and returns to the caller. The new coroutine is not started immediately, but scheduled for later execution during the application's update procedure. This gives the application an opportunity to service all pending messages and updates before the coroutine is actually started.
addInputHandler(msgtype, object, func)
Adds an object and
function to the application's chain of handlers for input of
the specified type. Currently, the only message type an appliction is
able to react on is ui.MSG_USER. All other message types are specific
to a Window. Input handlers are invoked as follows:
message = function(object, message)
The handler is expected to return the message, which will in turn pass it on to the next handler in the chain. See also Window:addInputHandler() for more information.
connect(parent)
Checks member linkage and connects all children by invoking their connect() methods. Note that unlike Element:connect(), this function is recursive.
selected = easyRequest(title, text, buttontext1[, ...])
This function shows a message box or requester. title will be
displayed as the window title; if this argument is false, the
application's ProgramName will be used for the title. text
(which may contain line breaks) will be used as the requester's body.
Buttons are ordered from left to right. The first button has the number 1.
If the window is closed using the Escape key or close button, the return
value will be false. Note: The caller of this function must be
running in a coroutine (see Application:addCoroutine()).
element = getById(id)
Returns the element that was registered with the
Application under its unique id. Returns nil if the id was not
found.
getLocale([deflang[, language]])
Returns a table of locale strings for
ApplicationId and Domain. See ui.getLocale() for more information.
remInputHandler(msgtype, object, func)
Removes an input handler that was previously registered with Application:addInputHandler().
status[, path, selection] = requestFile(args)
Requests a single or multiple files or directories. Possible keys in
the args table are:
Center- Boolean, whether requester should be opened centeredFocusElement- What element to place the initial focus on; see DirList for possible valuesHeight- Height of the requester windowLister- External lister object to operate onLocation- Initial contents of the requester's location fieldPath- The initial pathSelectMode-"multi"or"single"[default"single"]SelectText- Text to show on the select button [default"open"]Title- Window title [default"Select file or directory..."]Width- Width of the requester window
The first return value is a string reading either "selected" or
"cancelled". If the status is "selected", the second return value
is the path where the requester was left, and the third value is a table
of the items that were selected.
Note: The caller of this function must be running in a coroutine
(see Application:addCoroutine()).
success, status = run()
Runs the application. Returns when all child
windows are closed or when the application's Status is set to "quit".
retrig = setLastKey([newkey])
Sets newkey as the key that was last
pressed in the application. If no new key is given, the current key is
unset. Returns a boolean indicating whether it is the same as the
previously registered key.
suspend([window])
Suspends the caller (which must be running
in a coroutine) until it is getting rescheduled by the application.
Coroutines can use this as a cooperation point, which gives the
application an opportunity to service all pending messages and updates.
If no argument is given, the application returns to the caller as quickly
as possible. If an optional window is specified, the coroutine is put
to sleep until something happens in the application, or an interval timer
event is present at the window (i.e. the suspended coroutine is
rescheduled after no longer than 1/50th of a second).
Area (v44.0)
ClassOverview : Class / Object / Element / Area
This is the base class of all visible user interface elements. It implements an outer margin, layouting, drawing, and the relationships to its neighbour elements.
AutoPosition [ISG](boolean)When the element receives the focus, this flag instructs it to automatically position itself into the visible area of any Canvas that may contain it. An affected Canvas must have its
AutoPositionattribute enabled as well for this option to take effect (but unlike the Area class, in a Canvas it is disabled by default).BGPen [G](color specification)The current color (or texture) for painting the element's background. This value is set in Area:setState(), where it is derived from the element's current state and the background-color style property. Valid are color names (e.g.
"detail","fuchsia", see also Display for more), a hexadecimal RGB specification (e.g."#334455","#f0f"), or an image URL in the form"url(...)".DamageRegion [G](Region)see
TrackDamageDisabled [ISG](boolean)If true, the element is in disabled state and loses its ability to interact with the user. This state variable is handled in the Widget class.
EraseBG [ISG](boolean)If true, the element's background is painted automatically using the Area:erase() method. Set this attribute to false if you intend to paint the background yourself in Area:draw().
Flags [SG](Flags field)This attribute holds various status flags:
FL_SETUP- Set in Area:setup() and cleared in Area:cleanup()FL_LAYOUT- Set in Area:layout(), cleared in Area:cleanup()FL_SHOW- Set in Area:show(), cleared in Area:hide()FL_REDRAW- Set in Area:layout(), Area:damage(), Area:setState() and possibly other places to indicate that the element needs to be repainted. Cleared in Area:draw().FL_REDRAWBORDER- To indicate a repaint of the element's borders. Handled in the Frame class.FL_CHANGED- This flag indicates that the contents of an element have changed, i.e. when children were added to a group, or when setting a new text or image should cause a recalculation of its size.FL_POPITEM- Used to identify elements in popups, handled in PopItem.Focus [SG](boolean)If true, the element has the input focus. This state variable is handled by the Widget class. Note: This attribute represents only the current state. If you want to place the initial focus on an element, use the
InitialFocusattribute in the Widget class.HAlign [IG]("left","center","right")Horizontal alignment of the element in its group. This attribute can be controlled using the
halignstyle property.Height [IG](number, false,"fill","free")Height of the element, in pixels, or
- false - unspecified; during initialization, the class' default will be used
"free"- Allows the element's height to grow to any size."fill"- To fill up the height that other elements in the same group have claimed, without claiming more.This attribute can be controlled using the
heightstyle property.Hilite [SG](boolean)If true, the element is in highlighted state. This state variable is handled by the Widget class.
MaxHeight [IG](number)Maximum height of the element, in pixels [default:
ui.HUGE]. This attribute is controllable via themax-heightstyle property.MaxWidth [IG](number)Maximum width of the element, in pixels [default:
ui.HUGE]. This attribute is controllable via themax-widthstyle property.MinHeight [IG](number)Minimum height of the element, in pixels [default: 0]. This attribute is controllable via the
min-heightstyle property.MinWidth [IG](number)Minimum width of the element, in pixels [default: 0]. This attribute is controllable via the
min-widthstyle property.Selected [ISG](boolean)If true, the element is in selected state. This state variable is handled by the Widget class.
TrackDamage [ISG](boolean)If true, the element collects intra-area damages in a Region named
DamageRegion, which can be used by class writers to implement minimally invasive repaints. Default: false, the element is repainted in its entirety.VAlign [IG]("top","center","bottom")Vertical alignment of the element in its group. This attribute can be controlled using the
valignstyle property.Weight [IG](number)Specifies the weight that is attributed to the element relative to its siblings in the same group. By recommendation, the weights in a group should sum up to 0x10000.
Width [IG](number, false,"fill","free")Width of the element, in pixels, or
- false - unspecified; during initialization, the class' default will be used
"free"- Allows the element's width to grow to any size"fill"- To fill up the width that other elements in the same group have claimed, without claiming more.This attribute can be controlled using the
widthstyle property.
| background-attachment |
"scollable" or "fixed"
|
| background-color |
Controls Area.BGPen
|
| fixed |
coordinates used by the fixed layouter: "x0 y0 x1 y1"
|
| halign |
controls the Area.HAlign attribute
|
| height |
controls the Area.Height attribute
|
| margin-bottom | the element's bottom margin, in pixels |
| margin-left | the element's left margin, in pixels |
| margin-right | the element's right margin, in pixels |
| margin-top | the element's top margin, in pixels |
| max-height |
controls the Area.MaxHeight attribute
|
| max-width |
controls the Area.MaxWidth attribute
|
| min-height |
controls the Area.MinHeight attribute
|
| min-width |
controls the Area.MinWidth attribute
|
| padding-bottom | the element's bottom padding |
| padding-left | the element's left padding |
| padding-right | the element's right padding |
| padding-top | the element's top padding |
| valign |
controls the Area.VAlign attribute
|
| width |
controls the Area.Width attribute
|
Note that repainting elements with a
"fixed"background-attachment can be expensive. This variant should be used sparingly, and some classes may implement it incompletely or incorrectly.
- Area:askMinMax() - Queries the element's minimum and maximum size
- Area:checkFocus() - Checks if the element can receive the input focus
- Area:checkHover() - Checks if the element can be hovered over
- Area:damage() - Notifies the element of a damage
- Area:draw() - Paints the element
- Area:drawBegin() - Prepares the rendering context
- Area:drawEnd() - Reverts the changes made in drawBegin()
- Area:erase() - Erases the element's background
- Area:focusRect() - Makes the element fully visible, if possible
- Area:getBG() - Gets the element's background properties
- Area:getBGElement() - Gets the element's background element
- Area:getChildren() - Gets the element's children
- Area:getByXY() - Checks if the element covers a coordinate
- Area:getGroup() - Gets the element's group
- Area:getMargin() - Gets the element's margin
- Area:getMinMax() - Gets the element's calculated min/max sizes
- Area:getNext() - Gets the element's successor in its group
- Area:getPadding() - Gets the element's paddings
- Area:getParent() - Gets the element's parent element
- Area:getPrev() - Gets the element's predecessor in its group
- Area:getRect() - Returns the element's layouted coordinates
- Area:getSiblings() - Gets the element's siblings
- Area:hide() - Gets called when the element is about to be hidden
- Area:layout() - Layouts the element into a rectangle
- Area:passMsg() - Passes an input message to the element
- Area:punch() - Subtracts the outline of the element from a Region
- Area:rethinkLayout() - Causes a relayout of the element and its group
- Area:setState() - Sets the background attribute of an element
- Area:show() - Gets called when the element is about to be shown
minw, minh, maxw, maxh = Area:askMinMax(minw, minh, maxw, maxh)
This
method is called during the layouting process for adding the required
width and height to the minimum and maximum size requirements of the
element, before passing the result on to its super class. minw,
minh are cumulative of the minimal size of the element, while
maxw, maxw collect the size the element is allowed to expand to.
can_hover = Area:checkHover()
Returns true if this element can react on being hovered over by the pointing device.
Area:cleanup()
Clears all temporary layouting data and the FL_LAYOUT
and FL_SETUP flags, before passing on the call to Element:cleanup().
Area:damage(x0, y0, x1, y1)
If the element overlaps with the given
rectangle, this function marks it as damaged by setting ui.FL_REDRAW
in the element's Flag field. Additionally, if the element's
TrackDamage attribute is true, intra-area damage rectangles are
collected in DamageRegion.
success = Area:draw()
If the element is marked for a repaint (indicated
by the presence of the flag ui.FL_REDRAW in the Flags field),
draws the element into the rectangle that was assigned to it by the
layouter, clears ui.FL_REDRAW, and returns true. If the
atttribute EraseBG is set, this function also clears the element's
background by calling Area:erase().
When overriding this function, the control flow is roughly as follows:
function ElementClass:draw()
if SuperClass.draw(self) then
-- your rendering here
return true
end
end
There are rare occasions in which a class modifies the drawing context, e.g. by setting a coordinate displacement. Such modifications must be performed in Area:drawBegin() and undone in Area:drawEnd(). In this case, the control flow looks like this:
function ElementClass:draw()
if SuperClass.draw(self) and self:drawBegin() then
-- your rendering here
self:drawEnd()
return true
end
end
can_draw = Area:drawBegin()
Prepares the drawing context, returning a boolean indicating success. This function must be overridden if a class wishes to modify the drawing context, e.g. for installing a coordinate displacement.
Area:erase()
Clears the element's background. This method is invoked by
Area:draw() if the EraseBG attribute is set, and when a repaint is
possible and necessary. Area:drawBegin() has been invoked when this
function is called, and Area:drawEnd() will be called afterwards.
moved = Area:focusRect([x0, y0, x1, y1])
Tries to shift any Canvas containing the element into a position that makes the element fully visible. Optionally, a rectangle can be specified that is to be made visible. Returns true to indicate that some kind of repositioning has taken place.
bgpen[, tx, ty] = Area:getBG()
Gets the element's background properties.
bgpen is the background pen (which may be a texture). If the element's
background-attachment is "scrollable", then tx and ty are
the coordinates of the texture origin.
element = Area:getBGElement()
Returns the element that is responsible for painting the surroundings (or the background) of the element. This information is useful for painting transparent or translucent parts of the element, e.g. an inactive focus border.
element = Area:getChildren(init)
Returns a table containing the element's
children, or nil if this element cannot have children. The optional
argument init is true when this function is called during
initialization or deinitialization.
element = Area:getGroup(parent)
Returns the closest
Group containing the element. If the parent
argument is true, this function will start looking for the closest
group at its parent - otherwise, the element itself is returned if it is
a group already. Returns nil if the element is not currently
connected.
left, top, right, bottom = Area:getMargin()
Returns the element's margins in the order left, top, right, bottom.
minx, miny, maxx, maxy = Area:getMinMax()
Returns the element's calculated minimum and maximum size requirements, which are available after Area:askMinMax().
table = Area:getNext()
Returns the next element in the group, or, if the element has no successor, the next element in the parent group (and so forth, until it reaches the topmost group). Returns nil if the element is not currently connected.
element = Area:getParent()
Returns the element's parent element, or false if it currently has no parent.
element = Area:getPrev()
Returns the previous element in the group, or, if the element has no predecessor, the previous element in the parent group (and so forth, until it reaches the topmost group). Returns nil if the element is not currently connected.
x0, y0, x1, y1 = Area:getRect()
This function returns the rectangle which the element has been layouted to, or nil if the element has not been layouted yet.
table = Area:getSiblings()
Returns a table containing the element's siblings, which includes the element itself. Returns nil if the element is not currently connected. Note: The returned table must be treated read-only.
Area:hide()
Override this method to free all display-related resources previously allocated in Area:show().
changed = Area:layout(x0, y0, x1, y1[, markdamage])
Layouts the element
into the specified rectangle. If the element's (or any of its childrens')
coordinates change, returns true and marks the element as damaged,
unless the optional argument markdamage is set to false.
msg = Area:passMsg(msg)
This function filters the specified input message. After processing, it is free to return the message unmodified (thus passing it on to the next message handler), to return a copy that has certain fields in the message modified, or to absorb the message by returning false. If you override this function, you are not allowed to modify any data inside the original message; if you alter it, you must return a copy.
Area:punch(region)
Subtracts the element from (by punching a hole into) the specified Region. This function is called by the layouter.
Area:rethinkLayout([repaint[, check_size]])
Slates an element (and its
children) for relayouting, which takes place during the next Window update
cycle. If the element's coordinates change, this will cause it to be
repainted. The parent element (usually a Group) will be checked as well,
so that it has the opportunity to update its FreeRegion.
The optional argument repaint can be used to specify additional hints:
1- marks the element for repainting unconditionally (not implying possible children)2- marks the element (and all possible children) for repainting unconditionally
The optional argument check_size (a boolean) can be used to
recalculate the element's minimum and maximum size requirements.
Area:setState(bg)
Sets the BGPen attribute according to
the state of the element, and if it changed, marks the element
for repainting.
Area:setup(app, win)
After passing the call on to Element:setup(),
initializes fields which are being used by Area:layout(), and sets
FL_SETUP in the Flags field to indicate that the element is
ready for getting layouted and displayed.
Button (v2.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / Button
The Button class implements a Text element with a button mode (behavior) and button class (appearance). In addition to that, it enables the initialization of a possible keyboard shortcut from a special initiatory character (by default an underscore) preceding a letter in the element's
Textattribute.
This class adds redundancy, because it differs from the Text class only in that it specifies a few attributes differently in its
new()method. To avoid this overhead, use the Text class directly, or create a Button factory like this:function newButton(text) return ui.Text:new { Mode = "button", Class = "button", Text = text, KeyCode = true } end
Canvas (v30.0)
ClassOverview : Class / Object / Element / Area / Frame / Canvas
This class implements a scrollable area acting as a managing container for a child element. Currently, this class is used exclusively for child objects of the ScrollGroup class.
AutoPosition [IG](boolean)See Area
AutoHeight [IG](boolean)The height of the canvas is automatically adapted to the height of the region it is layouted into. Default: false
AutoWidth [IG](boolean)The width of the canvas is automatically adapted to the width of the canvas it is layouted into. Default: false
CanvasHeight [ISG](number)The height of the canvas in pixels
CanvasLeft [ISG](number)Left visible offset of the canvas in pixels
CanvasTop [ISG](number)Top visible offset of the canvas in pixels
CanvasWidth [ISG](number)The width of the canvas in pixels
Child [ISG](object)The child element being managed by the Canvas
KeepMinHeight [IG](boolean)Report the minimum height of the Canvas's child object as the Canvas' minimum display height
KeepMinWidth [IG](boolean)Report the minimum width of the Canvas's child object as the Canvas' minimum display width
UnusedRegion [G](Region)Region of the Canvas which is not covered by its
ChildUseChildBG [IG](boolean)If true, the Canvas borrows its background properties from its child for rendering its
UnusedRegion. If false, the Canvas' own background properties are used. Default: trueVScrollStep [IG](number)Vertical scroll step, used e.g. for mouse wheels
- Canvas:damageChild() - Damages a child object where it is visible
- Canvas:onSetChild() - Handler called when
Childis set- Canvas:updateUnusedRegion() - Updates region not covered by Child
- Object.addClassNotifications()
- Area:askMinMax()
- Element:cleanup()
- Element:connect()
- Area:damage()
- Element:decodeProperties()
- Element:disconnect()
- Area:draw()
- Area:drawBegin()
- Area:drawEnd()
- Element:erase()
- Area:focusRect()
- Area:getBG()
- Area:getBGElement()
- Area:getChildren()
- Area:getByXY()
- Area:hide()
- Object.init()
- Area:layout()
- Area:passMsg()
- Element:setup()
- Area:show()
damageChild(r1, r2, r3, r4)
Damages the specified region in the child area where it overlaps with the visible part of the canvas.
updateUnusedRegion()
Updates the UnusedRegion attribute, which
contains the Canvas' area which isn't covered by its Child.
CheckMark (v9.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / CheckMark
Specialization of the Text class, implementing a toggle button with a graphical check mark.
DirList (v16.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group / DirList
This class implements a directory lister.
AutoWidth [IG](boolean)Tells the directory lister to adapt its contents dynamically to the width of the element. By default, the column widths remain adjusted to the initial width.
FocusElement [I](string)What element to focus initially:
"path","location","list". Default:"list"Kind [IG](string)The visual appearance (or purpose) of the lister, which will determine the presence and arrangement of some interface elements:
"requester"- for a standalone file requester"lister"- for a directory lister component"simple"- for the use without accompanying elementsThe default kind is
"lister".Location [IG](string)The currently selected entry (may be a file or directory)
Path [IG](string)Directory in the file system
Selection [G](table)An array of selected entries
SelectMode [IG](String)Selection mode:
"single"- allows selections of one entry at a time"multi"- allows selections of multiple entriesSelectText [IG](String)The text to display on the selection button. Default:
"Open"(or its equivalent in the current locale)Status [G](string)Status of the directory lister:
"running"- the lister is currently being shown"selected"- the user has selected one or more entries"cancelled"- the lister has been cancelled by the user
- DirList:abortScan() - Aborts scanning
- DirList:getCurrentDir() - Gets the current directory
- DirList:getDirIterator() - Gets an iterator over a directory
- DirList:getFileStat() - Examines a file entry
- DirList:goParent() - Goes to the parent of the current directory
- DirList:onSelectEntry() - Handler invoked on selection of an entry
- DirList:showDirectory() - Reads and shows a directory
- DirList:scanEntry() - Scans a single entry in a directory
- DirList:showDirectory() - Starts scanning and displays a directory
- DirList:splitPath() - Splits a filename
abortScan()
This function aborts the coroutine which is currently scanning the directory. The caller of this function must be running in its own coroutine.
cdir = getCurrentDir()
Returns the current directory. You can override this function to implement your own filesystem semantics.
iterator = getDirIterator(directory)
Returns an iterator function for
traversal of the entries in the given directory. You can override this
function to get an iterator over arbitrary kinds of listings.
attr = getFileStat(path, name, attr[, idx])
Returns an attribute for the
entry of the given path and name; see the documentation of the
LuaFileSystem module for the attribute names and their meanings.
Currently, only the "mode" and "size" attributes are requested,
but if you override this function, it would be smart to implement as many
attributes as possible. idx is optional and specifies the entry number
inside the list, which is an information that may or may not be supplied
by the calling function.
onSelectEntry(lnr, name, type)
This handler is called when an item in the
list was selected by the user. It is passed the line number, name and
type of the entry (which can be "file" or "directory").
table, type = scanEntry(path, name, idx)
Scans a single entry
name in a directory named path. idx is the entry number
with which this scanned entry will appear in the directory listing.
table is an array of strings, containing entries like name, size,
date, permissions, modification date etc. The type return value
corresponds to the return values of DirList:getFileStat().
path, part = splitPath(path)
Splits a path, returning a path and the rearmost path or file part. You can override this function to implement your own file system naming conventions.
Display (v25.1)
ClassOverview : Class / Object / Display
This class manages a display.
AspectX [IG](number)
- X component of the display's aspect ratio
AspectY [IG](number)
- Y component of the display's aspect ratio
- Display:closeFont() - Closes font
- Display.createPixMap() - Creates a pixmap from picture file data
- Display:getFontAttrs() - Gets font attributes
- Display.getPixmap() - Gets a a pixmap from the cache
- Display:colorToRGB() - Converts a color specification to RGB
- Display:getTime() - Gets system time
- Display.loadPixmap() - Loads a pixmap from the file system
- Display:openFont() - Opens a named font
- Display:openVisual() - Opens a visual
- Display:sleep() - Sleeps for a period of time
fontfont-fixedfont-hugefont-largefont-menufont-smallrgb-activergb-active-detailrgb-backgroundrgb-border-focusrgb-border-legendrgb-border-rimrgb-border-shadowrgb-border-shinergb-cursorrgb-cursor-detailrgb-darkrgb-detailrgb-disabledrgb-disabled-detailrgb-disabled-detail-shinergb-fillrgb-focusrgb-focus-detailrgb-grouprgb-half-shadowrgb-half-shinergb-hoverrgb-hover-detailrgb-listrgb-list-activergb-list-active-detailrgb-list-detailrgb-list-altrgb-menurgb-menu-activergb-menu-active-detailrgb-menu-detailrgb-outlinergb-shadowrgb-shinergb-user1rgb-user2rgb-user3rgb-user4
a, r, g, b = colorToRGB(key)
Gets the r, g, b values of a color. The color can be a hexadecimal RGB specification or a symbolic name.
image, width, height, transparency = Display.createPixmap(picture)
Creates a pixmap object from data in a picture file format. Currently only the PPM file format is recognized.
h, up, ut = getFontAttrs(font)
Returns the font attributes height, underline position and underline thickness.
image, width, height, transparency = Display.getPixmap(fname)
Gets a pixmap object, either by loading it from the filesystem or by retrieving it from the cache.
image, width, height, transparency = Display.loadPixmap(filename)
Creates a pixmap object from an image file in the file system. Currently only the PPM file format is recognized.
Element (v19.1)
ClassOverview : Class / Object / Element
This class implements the connection to a global environment and the registration by Id.
Application [G](Application)The Application the element is registered with. This attribute is set during Element:setup().
Class [ISG](string)The name of the element's style class, which can be referenced in a style sheet. Multiple classes can be specified by separating them with spaces, e.g.
"button knob warn". Setting this attribute invokes the Element:onSetClass() method.Id [IG](string)An unique Id identifying the element. If present, this Id will be registered with the Application during Element:setup().
Parent [G](object)Parent object of the element. This attribute is set during Element:connect().
Properties [G](table)A table of properties, resulting from element and user style classes, overlaid with individual and direct formattings, and finally from hardcoded element properties. This table is initialized in Element:decodeProperties().
Style [ISG](string)Direct style formattings of the element, overriding class-wide formattings in a style sheet. Example:
"background-color: #880000; color: #ffff00"Setting this attribute invokes the Element:onSetStyle() method.
Window [G](Window)The Window the element is registered with. This attribute is set during Element:setup().
- Element:addStyleClass() - Appends a style class to an element
- Element:cleanup() - Unlinks the element from its environment
- Element:connect() - Connects the element to a parent element
- Element:decodeProperties() - Decodes the element's style properties
- Element:disconnect() - Disconnects the element from its parent
- Element:getAttr() - Gets a named attribute from an element
- Element:getById() - Gets a registered element by Id
- Element:onSetClass() - Gets invoked on changes of
Class- Element:onSetStyle() - Gets invoked on changes of
Style- Element:setup() - Links the element to an Application and Window
success = Element:connect(parent)
Attempts to connect the element to the
given parent element; returns a boolean indicating whether the
connection succeeded.
Element:decodeProperties(stylesheets)
This function decodes the element's
style properties and places them in the Properties table.
ret1, ... = Element:getAttr(attribute, ...)
This function gets a named
attribute from an element, returning nil if the attribute is
unknown.
Element:getById(id)
Gets the element with the specified id, that was
previously registered with the Application.
This function is a shortcut for Application:getById(), applied to
self.Application.
Element:onSetClass()
This method is invoked when the Class
attribute has changed. The implementation in the Element class invokes
Element:onSetStyle().
Element:setup(app, window)
This function attaches an element to the specified Application and Window, and registers the element's Id (if any) at the application.
Family (v2.5)
ClassOverview : Class / Object / Family
This class implements a container for child objects.
Children [IG](table)Array of child objects
- Family:addMember() - Adds an element to a Family
- Family:remMember() - Removed an element from a Family
success = addMember(child[, pos])
Invokes the child's
connect() method to check for its ability to
integrate into the family, and if successful, inserts it into the
Family's list of children. Optionally, the child is inserted into the
list at the specified position.
success = remMember(child)
Looks up child in the family's list of
children, and if it can be found, invokes its
disconnect() method and removes it from the list.
FloatText (v21.0)
ClassOverview : Class / Object / Element / Area / FloatText
This class implements a scrollable display of text. An object of this class is normally the immediate child of a Canvas.
FGPen [IG](userdata)Pen for rendering the text. This attribute is controllable via the
colorstyle property.Font [IG](string)Font specifier; see Text for a format description. This attribute is controllable via the
fontstyle property.Preformatted [IG](boolean)Boolean, indicating that the text is already formatted and should not be reformatted to fit the element's width.
Text [ISG]](string)The text to be displayed
- FloatText:appendLine() - Append a line of text
- FloatText:onSetText() - Handler called when
Textis changed
color
|
controls the FloatText.FGPen attribute
|
font
|
controls the FloatText.Font attribute
|
appendLine(text[, movetail])
Append a line of text; if the
optional boolean movetail is true, the visible area of the
element is moved towards the end of the text.
Frame (v21.0)
ClassOverview : Class / Object / Element / Area / Frame
This class implements an element's borders. The default border class handles up to three sub borders:
- The main border is the innermost of the three sub borders. It is used to render the primary border style, which can be inset, outset, ridge, groove, or solid. This border has priority over the other two.
- The rim border separates the two other borders and may give the composition a more contrastful look. This border has the lowest priority.
- The focus border (in addition to the element's focus highlighting style) can be used to visualize that the element is currently receiving the input. This is the outermost of the three sub borders. When the element is in unfocused state, this border often appears in the same color as the surrounding group, making it indistinguishable from the surrounding background.
Border classes do not have to implement all sub borders; these properties are all handled by the default border class internally, and more (and other) sub borders and properties may be defined and implemented in the future (or in other border classes). As the Frame class has no notion of sub borders, their respective widths are subtracted from the Element's total border width, leaving only the remaining width for the main border.
BorderRegion [G](Region)Region object holding the outline of the element's border
Legend [IG](string)Border legend text
| border-bottom-color | controls the default border class |
| border-bottom-width |
controls Frame.Border
|
| border-class |
controls Frame.BorderClass
|
| border-color | controls the default border class |
| border-focus-color | controls the default border class |
| border-focus-width | controls the default border class |
| border-left-color | controls the default border class |
| border-left-width |
controls Frame.Border
|
| border-legend-font | controls the default border class |
| border-right-color | controls the default border class |
| border-right-width |
controls Frame.Border
|
| border-rim-color | controls the default border class |
| border-rim-width | controls the default border class |
| border-style | controls the default border class |
| border-top-color | controls the default border class |
| border-top-width |
controls Frame.Border
|
| border-width |
controls Frame.Border
|
- Frame:drawBorder() - Draws the element's border
- Frame:getBorder() - Queries the element's border
b1, b2, b3, b4 = Frame:getBorder()
Returns an element's border widths in the order left, top, right, bottom.
Gauge (v17.0)
Group (v31.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group
This class implements a container for child elements and various layouting options.
Children [IG](table)A table of the object's children
Columns [IG](number)Grid width, in number of elements [Default: 1, not a grid]
FreeRegion [G](Region)Region inside the group that is not covered by child elements
Layout [IG](string or Layout)The name of a layouter class (or a Layouter object) used for layouting the element's children. Default:
"default"Orientation [IG](string)Orientation of the group; can be
"horizontal"- The elements are layouted horizontally"vertical"- The elements are layouted verticallyDefault:
"horizontal"Rows [IG](number)Grid height, in number of elements. [Default: 1, not a grid]
SameSize [IG](boolean,"width","height")true indicates that the same width and height should be reserved for all elements in the group; the keywords
"width"and"height"specify that only the same width or height should be reserved, respectively. Default: false
Group:addMember()- See Family:addMember()Group:remMember()- See Family:remMember()
Handle (v6.0)
Layout (v1.0)
ClassOverview : Class / Layout
A layouter implements a group's layouting strategy. The
"default"layouter implements a dynamic, scalable layout, which adapts to the free space available to the group.
- Layout:layout() - Layouts the group
- Layout:askMinMax() - Queries the group's minimum and maximum size requirements
minw, minh, maxw, maxh = Layout:askMinMax(group, minw, minh, maxw, maxh)
This function queries the specified Group for its size requirements.
Layout:layout(group, x0, y0, x1, y1[, markdamage])
Layouts the Group into the specified
rectangle and calculates the new sizes and positions of all of its
children. The optional boolean markdamage is passed to subsequent
invocations of child:layout(). This function will
also call the punch() method on each child for
subtracting their new outlines from the group's FreeRegion.
Lister (v30.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / Lister
This class implements a scrollable list or table. Each item in the list is a table consisting of the following elements:
{ { "column1", "column2", ... }, userdata, selected, ... }Description:
entry[1]is a table containing the text of each column;entry[2]is a userdata field which can be used at will;entry[3]is a boolean indicating that the line is selected.The following fields are reserved for internal use by the Lister; you should never rely on their contents or modify them.
AlignColumn [IG](number)A column number to align the right edge of the list to. [Default: unspecified]
AlignElement [IG](Object)The object determining the right edge of the list, which is an information needed for the
AlignColumnattribute. By default, the Lister's parentCanvasis used, but by use of this attribute it is possible to align the Lister to something else.BGAlt [IG](userdata)A colored pen for painting the background of alternating lines
ColumnPadding [IG](number)The padding between columns, in pixels. By default, the Lister's
Fontis used to determine a reasonable offset.CursorBorderClass [IG](string)Name of the border class used to implement this element's cursor border. Default: "default"
CursorLine [ISG](number)The line number of the Lister's cursor; this value may be
0, in which case the cursor is invisible. Changing this value will invoke the Lister:onSetCursor() method.Font [IG](string)Font specifier for determining the font used for list entries. See Text for details on its format.
HeaderGroup [IG](Group)A group of elements used for the table header. The Lister may take these elements into account for determining the initial column widths.
ListObject [IG](List)The List object the Lister operates on; if none is specified, the Lister creates an empty one.
NumSelectedLines [G](number)The number of lines currently selected.
SelectedLines [G](table)This attribute is a (sparse) table containing the numbers of selected lines in the list. Use
pairs()to iterate it. See also Lister:getSelectedLines() for retrieving a numerically indexed list.SelectedLine [ISG](number)The Lister's current selected line; this value reflects only the line that was most recently selected or unselected - for locating all currently selected lines, you will also need the
SelectedLinesattribute. Setting this value will invoke the Lister:onSelectLine() method.SelectMode [IG](string)The Lister's selection mode, which can be
"none","single", or"multi".
- Lister:addItem() - Adds an item to the list
- Lister:changeItem() - Overwrite item in the list
- Lister:changeSelection() - Changes selection of the list
- Lister:clear() - Removes all items from the list
- Lister:damageLine() - Marks line for repainting
- Lister:getItem() - Returns the item at the specified line
- Lister:getN() - Returns the number of entries in the list
- Lister:getSelectedLines() - Returns a table of selected entries
- Lister:onSelectLine() - Handler invoked for
SelectedLine- Lister:onSetCursor() - Handler invoked for
CursorLine- Lister:repaint() - Relayouts and repaints the list
- Lister:remItem() - Removes an item from the list
- Lister:setList() - Sets a new list object
background-color2
addItem(item[, line[, quick]])
Adds an item to the list. If
line is unspecified, the entry is added at the end of the list. The
boolean quick indicates that the list should not be relayouted and
repainted. (For relayouting and repainting the list after mass addition,
see also Lister:repaint().)
changeItem(item, line[, quick])
Overwrites the item at the
specified line in the list. The boolean quick indicates that
the list should not be relayouted and repainted. For relayouting and
repainting the list after mass changes, see also Lister:repaint().
changeSelection(mode)
Changes the selection of the entire list; modes supported are:
- "none": marks all lines as unselected
getSelectedLines([mode])
Returns a table of all selected entries, sorted by (by default) their line number. Currently defined modes are "ascending" or "descending". Default: "ascending"
remItem(line[, quick])
Removes the item from the list at the
specified line. The boolean quick indicates that the list should not
be relayouted and repainted. (For relayouting and repainting the list
after mass removal, see also Lister:repaint().)
ListView (v6.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group / ListView
This class implements a Group containing a ScrollGroup and optionally a group of column headers; its main purpose is to automate the somewhat complicated setup of multi-column lists with headers, but it can be used for single-column lists and lists without column headers as well.
Headers [I](table)An array of strings containing the captions of column headers. [Default: unspecified]
HSliderMode [I](string)This attribute is passed on the ScrollGroup - see there.
VSliderMode [I](string)This attribute is passed on the ScrollGroup - see there.
MenuItem (v10.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / PopItem / MenuItem
This class implements basic, recursive items for window and popup menus with a typical menu look; in particular, it displays the PopItem's
Shortcutstring and an arrow to indicate the presence of a sub menu.
Numeric (v4.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Numeric
This class implements the management of numerical values. Without further specialization it has hardly any real-life use and may be considered an abstract class. See also Gauge and Slider for some of its child classes.
Default [IG](number)The default for
Value, which can be revoked using the Numeric:reset() method.Max [ISG](number)Maximum acceptable
Value. Setting this value invokes the Numeric:onSetMax() method.Min [ISG](number)Minimum acceptable
Value. Setting this value invokes the Numeric:onSetMin() method.Step [ISG](number)Default step value [Default: 1]
Value [ISG](number)The current value represented by this class. Setting this value causes the Numeric:onSetValue() method to be invoked.
- Numeric:decrease() - Decreases
Value- Numeric:increase() - Increases
Value- Numeric:onSetMax() - Handler for the
Maxattribute- Numeric:onSetMin() - Handler for the
Minattribute- Numeric:onSetValue() - Handler for the
Valueattribute- Numeric:reset() - Resets
Valueto theDefaultvalue
decrease([delta])
Decrease Value by the specified delta.
If delta is omitted, the Step attribute is used in its place.
increase([delta])
Increase Value by the specified delta.
If delta is omitted, the Step attribute is used in its place.
PageGroup (v19.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group / PageGroup
Implements a group whose children are layouted in individual pages.
PageCaptions [IG](table)An array of strings containing captions for each page in the group. If false, no page captions will be displayed. [Default: false]
PageNumber [ISG](number)Number of the page that is initially selected. [Default: 1] Setting this attribute invokes the PageGroup:onSetPageNumber() method.
- PageGroup:disablePage() - Enables a Page
- PageGroup:onSetPageNumber() - Handler for
PageNumber
disablePage(pagenum, onoff)
This function allows to disable or re-enable
a page button identified by pagenum.
PopItem (v22.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / PopItem
This class provides an anchorage for popups. This also works recursively, i.e. elements of the PopItem class may contain other PopItems as their children. The most notable child class of the PopItem is the MenuItem.
Children [I](table)Array of child objects - will be connected to the application while the popup is open.
Shortcut [IG](string)Keyboard shortcut for the object; unlike Widget.KeyCode, this shortcut is also enabled while the object is invisible. By convention, only combinations with a qualifier should be used here, e.g.
"Alt+C","Shift+Ctrl+Q". Qualifiers are separated by"+"and must precede the key. Valid qualifiers are:
"Alt","LAlt","RAlt""Shift","LShift","RShift""Ctrl","LCtrl","RCtrl""IgnoreCase"- pseudo-qualifier; ignores the Shift key"IgnoreAltShift"- pseudo-qualifier, ignores the Shift and Alt keysAlias names for keys are
"F1"..."F12"(function keys),"Left","Right","Up","Down"(cursor keys)"BckSpc","Tab","Esc","Insert","Overwrite","PageUp","PageDown","Pos1","End","Print","Scroll", and"Pause"}}.
PopList (v13.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / PopItem / PopList
This class is a specialization of a PopItem allowing the user to choose an item from a list.
ListObject [IG](List)List object
SelectedLine [ISG](number)Number of the selected entry, or 0 if none is selected. Changing this attribute invokes the PopList:onSelectLine() method.
- PopList:onSelectLine() - Handler for the
SelectedLineattribute- PopList:setList() - Sets a new list object
PopupWindow (v5.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group / Window / PopupWindow
This class specializes a Window for the use by a PopItem.
RadioButton (v6.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / CheckMark / RadioButton
Specialization of a CheckMark to implement mutually exclusive 'radio buttons'.
ScrollBar (v13.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group / ScrollBar
Implements a group containing a Slider and arrow buttons.
AcceptFocus [IG](boolean)If false, the elements inside the scrollbar (slider, arrows) abstain from receiving the input focus, which means that they can only be operated with the mouse. Default: true
Integer [IG](boolean)If true, integer steps are enforced. By default, the slider moves continuously.
Max [ISG](number)The maximum value the slider can accept. Setting this value invokes the ScrollBar:onSetMax() method.
Min [ISG](number)The minimum value the slider can accept. Setting this value invokes the ScrollBar:onSetMin() method.
Orientation [IG](string)The orientation of the scrollbar, which can be "horizontal" or "vertical"
Range [ISG](number)The range of the slider, i.e. the size it represents. Setting this value invokes the ScrollBar:onSetRange() method.
Value [ISG](number)The value of the slider. Setting this value invokes the ScrollBar:onSetValue() method.
- ScrollBar:onSetMax() - Handler for the
Maxattribute- ScrollBar:onSetMin() - Handler for the
Minattribute- ScrollBar:onSetRange() - Handler for the
Rangeattribute- ScrollBar:onSetValue() - Handler for the
Valueattribute
onSetMax()
This handler is invoked when the ScrollBar's Max
attribute has changed. See also Numeric:onSetMax().
onSetMin()
This handler is invoked when the ScrollBar's Min
attribute has changed. See also Numeric:onSetMin().
onSetRange()
This handler is invoked when the ScrollBar's Range
attribute has changed. See also Slider:onSetRange().
onSetValue()
This handler is invoked when the ScrollBar's Value
attribute has changed. See also Numeric:onSetValue().
ScrollGroup (v17.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group / ScrollGroup
This class implements a group containing a scrollable container and accompanying elements such as horizontal and vertical ScrollBars.
AcceptFocus [IG](boolean)This attribute is passed to the scrollbar elements inside the scroll group. See ScrollBar
Child [IG](Canvas)Specifies the Canvas which encapsulates the scrollable area and children.
HSliderMode [IG](string)Specifies when the horizontal ScrollBar should be visible:
"on"- The horizontal scrollbar is displayed"off"- The horizontal scrollbar is not displayed"auto"- The horizontal scrollbar is displayed when the Lister is wider than the currently visible area.Note: The use of the
"auto"mode is currently (v8.0) discouraged.VSliderMode [IG](string)Specifies when the vertical ScrollBar should be visible:
"on"- The vertical scrollbar is displayed"off"- The vertical scrollbar is not displayed"auto"- The vertical scrollbar is displayed when the Lister is taller than the currently visible area.Note: The use of the
"auto"mode is currently (v8.0) discouraged.
Slider (v24.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Numeric / Slider
This class implements a slider for adjusting a numerical value.
AutoFocus [IG](boolean)If true and the slider is receiving the focus, it reacts on keyboard shortcuts instantly; otherwise, it must be selected first (and deselected afterwards). Default: false
Child [IG](Widget)A Widget object for being used as the slider's knob. By default, a knob widget of the style class
"knob"is created internally.Integer [IG](boolean)If true, integer steps are enforced. By default, the slider knob moves continuously.
Kind [IG](string)Kind of the slider:
"scrollbar"- for scrollbars. Sets the additional style class"knob-scrollbar"."number"- for adjusting numbers. Sets the additional style class"knob-number".Default: false, the kind is unspecified.
Orientation [IG](string)Orientation of the slider, which can be
"horizontal"or"vertical". Default:"horizontal"Range [ISG](number)The size of the slider, i.e. the range that it represents. Setting this value invokes the Slider:onSetRange() method.
Spacer (v2.1)
ClassOverview : Class / Object / Element / Area / Frame / Spacer
This class implements a separator that helps to arrange elements in a group.
Text (v28.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text
This class implements widgets with text.
KeepMinHeight [IG](boolean)After the initial size calculation, keep the minimal height of the element and do not rethink the layout in response to a possible new minimal height (e.g. resulting from a newly set text).
KeepMinWidth [IG](boolean)After the initial size calculation, keep the minimal width of the element and do not rethink the layout in response to a possible new minimal width (e.g. resulting from a newly set text).
Text [ISG](string)The text that will be displayed on the element; it may span multiple lines (see also Text:makeTextRecords()). Setting this attribute invokes the Text:onSetText() method.
| color-disabled | Secondary color for text in disabled state |
| font | Font specification, see below |
| text-align |
"left", "center", "right"
|
| vertical-align |
"top", "center", "bottom"
|
A font is specified in the form
"[fontname1,fontname2,...][:][size]"Font names, if specified, will be probed in the order of their occurrence in the string; the first font that can be opened will be used. For the font names, the following predefined named are supported:
- ui-fixed - The default fixed font
- ui-main (or an empty string) - The default main font, e.g. for buttons and menus
- ui-small - The default small font, e.g. for group captions
- ui-large - The default 'large' font
- ui-huge - The default 'huge' font
If no font name is specified, the main font will be used. The size specification (in pixels) is optional as well; if absent, the respective font's default size will be used.
- Text:getTextSize() - Gets the total extents of all text records
- Text:makeTextRecords() - Breaks text into multiple line records
- Text:onSetText() - Handler for changes of the
Textattribute
width, height = getTextSize([textrecord])
This function calculates the total width and height required by the object's text records. Optionally, it can be passed a table of text records which are to be evaluated.
makeTextRecords(text)
This function parses the given text, breaks it
along the encountered newline characters into single-line records, and
places the resulting table in the element's TextRecords field.
Each record has the form
{ [1]=text, [2]=font, [3]=align-horizontal, [4]=align-vertical,
[5]=margin-left, [6]=margin-right, [7]=margin-top,
[8]=margin-bottom, [9]=font-height, [10]=text-width }
More undocumented fields may follow at higher indices. font is taken
from opening the font specified in the object's Font attribute,
which also determines font-height and is used for calculating the
text-width (in pixels). The alignment parameters are taken from the
object's TextHAlign and TextVAlign attributes, respectively.
TextInput (v18.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Text / TextInput
This class implements a widget for entering and editing text.
Enter [SG](string)The text that is being entered (by pressing the Return key) into the input field. Setting this value causes the invocation of the TextInput:onEnter() method.
EnterNext [IG](boolean)Indicates that by pressing the Return key, the focus should advance to the next element that can receive input.
TabEnter [IG](boolean)Indicates that leaving the element by pressing the Tab key should set the
Enterattribute and invoke the respective handler.
cursor-background-colorcursor-color
- TextInput:addChar() - Perform character addition
- TextInput:backSpace() - Perform 'Backspace' function
- TextInput:delChar() - Perform 'Del' function
- TextInput:getChar() - Get character under cursor or at position
- TextInput:getCursor() - Get cursor position
- TextInput:moveCursorLeft() - Move the cursor one step to the left
- TextInput:moveCursorRight() - Move the cursor one step to the right
- TextInput:onEnter() - Handler invoked when
Enterist set- TextInput:setCursor() - Set cursor position
onEnter()
This method is called when the Enter attribute is
set. It can be overridden for reacting on entering text by pressing
the return key. The implementation in this class also sets the Text
attribute (see Text).
self:setCursor(pos)
Set absolute cursor position. If pos is
"eol", the cursor is positioned to the end of the string.
Widget (v25.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget
This class implements interactions with the user.
Active [SG](boolean)The Widget's activation state. While true, the position of the pointing device is being verified (which is also reflected by the
Hoverattribute, see below). When theActivestate variable changes, the Widget's behavior depends on itsModeattribute (see below):
- in button mode, the
Selectedattribute is set to the value of theHoverattribute. When theSelectedstate changes, thePressedattribute is set to the value of theActiveattribute.- in toggle mode, the
Selectedattribute is inverted logically, and thePressedattribute is set to true.- in touch mode, the
SelectedandPressedattributes are set to true, if the Widget was not selected already.Changing this attribute invokes the Widget:onActivate() method.
DblClick [SG](boolean)Signifies that the element is or has been double-clicked; it is set to true when the element was double-clicked and is still being held, and false when the second press has been released. Changes to this attribute cause the invocation of the Widget:onDblClick() method.
FGPen [IG](color specification)A color specification for rendering the foreground details of the element. This attribute is controllable via the color style property.
Hold [SG](boolean)Signifies that the element is being pressed for an extended period. While being held, the value is repeatedly set to true in intervals of
n/50seconds, withntaken from the Window'sHoldTickRepeatattribute. When the element is released, this attribute is set to false. Changes to this attribute cause the invocation of the Widget:onHold() method.Hover [SG](boolean)Signifies a change of the element being hovered by the pointing device. Changes to this state variable invoke Widget:onHover().
InitialFocus [IG](boolean)Specifies that the element should receive the focus initially. If true, the element will set the element's
Focusattribute to true upon invocation of the show method.KeyCode [IG](string or boolean)If set, a keyboard equivalent for activating the element. See PopItem for a discussion of denoting keyboard qualifiers. The Text class allows setting this attribute to true, in which case the element's
Textwill be examined during setup for an initiatory character (by default an underscore), and if found, theKeyCodeattribute will be replaced by the character following this marker.Mode [ISG](string)The element's interaction mode:
"inert": The element does not react on input"touch": The element does not rebound and keeps itsSelectedstate; it cannot be unselected by the user and always submits true for thePressedandSelectedattributes."toggle": The element does not rebound immediately and keeps itsSelectedstate until the next activation."button": The element rebounds when the pointing device over it is being released, or when it is no longer hovering it.See also the
Activeattribute.Pressed [SG](boolean)Signifies that a button was pressed or released. Changes to this state variable invoke Widget:onPress().
| color |
controls the Widget.FGPen attribute
|
| effect-class | name of an class for rendering an overlay effect |
| effect-color | controls the ripple effect hook |
| effect-color2 | controls the ripple effect hook |
| effect-kind | controls the ripple effect hook |
| effect-maxnum | controls the ripple effect hook |
| effect-maxnum2 | controls the ripple effect hook |
| effect-orientation | controls the ripple effect hook |
| effect-padding | controls the ripple effect hook |
| effect-ratio | controls the ripple effect hook |
| effect-ratio2 | controls the ripple effect hook |
A possible name for the effect-class property is
"ripple". As its name suggests, it can paint various ripple effects (e.g. for slider knobs and bar handles). Effect hooks are loaded fromtek.ui.hookand may define their own style properties.
| active | for elements in active state |
| disabled | for elements in disabled state |
| focus | for elements that have the input focus |
| hover | for elements that are being hovered by the mouse |
- Widget:onActivate() - Handler for
Active- Widget:onClick() - Gets called when the element has been clicked
- Widget:onDblClick() - Handler for
DblClick- Widget:onDisable() - Handler for
Disabled- Widget:onFocus() - Handler for
Focus- Widget:onHilite() - Handler for
Hilite- Widget:onHold() - Handler for
Hold- Widget:onHover() - Handler for
Hover- Widget:onPress() - Handler for
Pressed- Widget:onSelect() - Handler for
Selected
Widget:onClick()
This method is called when the Pressed attribute
changes from true to false, indicating that the pointing
device has been released over the element.
Widget:onDblClick()
This method is invoked when the DblClick
attribute has changed. It is true when the double click was
initiated and the mouse button is still held, and false when it has
been released.
Widget:onDisable()
This method is invoked when the Disabled
attribute has changed. The Disabled attribute is defined in the
Area class.
Widget:onFocus()
This method is invoked when the Focus
attribute has changed. The Focus attribute is defined in the
Area class.
Widget:onHilite()
This handler is called when the Hilite
attribute has changed. The Hilite attribute is defined in the
Area class.
Widget:onSelect()
This method is invoked when the Selected
attribute has changed. The Selected attribute is defined in the
Area class.
Window (v33.0)
ClassOverview : Class / Object / Element / Area / Frame / Widget / Group / Window
This class implements a Group which fills up a window on the Display.
Center [IG](boolean)Instructs the Window to open centered.
DblClickJitter [IG](number)Maximum sum of squared pixel deltas (dx² + dy²) between mouse positions to be tolerated for a double click. The default is 70. Large touchscreens require a much larger value.
DblClickTimeout [IG](number)Maximum number of microseconds between events to be recognized as a double click. Default: 32000. Use a larger value for touchscreens.
FullScreen [IG](boolean)Instructs the Window to open borderless and in fullscreen mode.
HideOnEscape [IG](boolean)Instructs the window to invoke the Window:onHide() method when the Escape key is pressed. Default: false
Left [IG](number)The window's left offset on the display, in pixels
Modal [IG](boolean)Instructs all other windows to reject input while this window is open.
MouseX [G](number)MouseY [G](number)The current window coordinates of the pointing device.
Status [ISG](string)Status of the Window, which can be:
"initializing"- The window is initializing"hide"- The window is hidden or about to hide; if you initialize the Window with this value, it will be created in hidden state."opening"- The window is about to open."show"- The window is shown."closing"- The Window is about to hide.Changing this attribute invokes the Window:onChangeStatus() method.
Title [IG](string)The window's title
Top [IG](number)The window's top offset on the display, in pixels
- Window:addInputHandler() - Adds an input handler to the window
- Window:addInterval() - Adds an interval timer to the window
- Window:checkDblClickTime() - Checks a time for a doubleclick event
- Window:clickElement() - Simulates a click on an element
- Window:onChangeStatus() - Handler for
Status- Window:onHide() - Handler for when the window is about to be closed
- Window:postMsg() - Post an user message in the Window's message queue
- Window:remInputHandler() - Removes an input handler from the window
- Window:remInterval() - Removes an interval timer from the window
- Window:setActiveElement() - Sets the window's active element
- Window:setDblClickElement() - Sets the window's doubleclick element
- Window:setFocusElement() - Sets the window's focused element
- Window:setHiliteElement() - Sets the window's hover element
- Window:setMovingElement() - Sets the window's moving element
addInputHandler(msgtype, object, function)
Adds an object and
a function to the window's chain of handlers for input of the
specified type. Multiple input types can be handled by one handler by
logically or'ing message types. Input handlers are invoked as follows:
message = function(object, message)
The handler is expected to return the message, which will in turn pass it on to the next handler in the window's chain.
addInterval()
Adds an interval timer to the window, which will furtheron generate MSG_INTERVAL messages 50 times per second. These messages cause a considerable load to the application, therefore each call to this function should be paired with an matching call to Window:remInterval(), which will cause the interval timer to stop when no clients are needing it anymore.
dblclick = checkDblClickTime(as, au, bs, bu)
Check if the two
given times (first a, second b) are within the doubleclick interval.
Each time is specified in seconds (s) and microseconds (u).
Returns true if the two times are indicative of a double click.
clickElement(element)
This function performs a simulated click on
the specified element; if element is a string, it will be looked up
using Application:getById(). This function is actually a shorthand
for Window:setHiliteElement(), followed by Window:setActiveElement() twice
(first to enable, then to disable it).
onHide()
This handler is invoked when the window's close button
is clicked (or the Escape key is pressed and the HideOnEscape flag
is set). The Window class' implementation of this handler is to hide
the window by setting the Status attribute to "hide". When the
last window is closed, the application is closed down.
remInputHandler(msgtype, object, func)
Removes an input handler that was previously registered with the window using Window:addInputHandler().
remInterval()
Decreases the use counter for interval messages and stops sending interval messages to the window when called by the last client that has previously requested an interval timer using Window:addInterval().
setActiveElement(element)
Sets/unsets the element which is
currently active (or 'in use'). If element is nil, the currently
active element will be deactivated.
setDblClickElement(element)
Sets/unsets the element which is
candidate for double click detection. If the element is set twice in a
sufficiently short period of time and the pointing device did not move
too much since the first event, the double click is triggered by
notifying the DblClick attribute in the element. See also
Widget for further information.
DefaultLayout (v7.1)
ClassOverview : Class / Layout / DefaultLayout
This class implements a Group's default layouting strategy. The standard strategy is to adapt a Group's contents dynamically to the free space available. It takes into account an element's
HAlign,VAlign,Width, andHeightattributes.
DefaultLayout (v7.1)
ClassOverview : Class / Layout / DefaultLayout
This class implements a Group's default layouting strategy. The standard strategy is to adapt a Group's contents dynamically to the free space available. It takes into account an element's
HAlign,VAlign,Width, andHeightattributes.
FixedLayout (v2.0)
ClassOverview : Class / Layout / FixedLayout
This class implements a Group's fixed layouting strategy. Using the fixed layouter, the size and position of individual elements in a group is predetermined by the contents of their fixed style property, with the coordinates of the rectangle in the order left, top, right, bottom, e.g.:
ui.Window:new { Layout = "fixed", Width = 400, Height = 400, Children = { ui.Button:new { Style = "fixed: 10 280 60 320" } } }