Minimum Application - WIN
The following is the minimum code necessary to create an
application.
-- collect any program arguments
local app_args = { ... }
-- create the application's main frame
local appFrame = win.create_app_frame ()
-- run the application's loop
appFrame:run_app ()
The win.create_app_frame
function creates and returns an applicationFrame window, which is
the main frame for the application. The frame's run_app
method sets the application's thread into modal state, where it runs
in a loop processing events until the application quits. The call to
run_app
must be the last statement in the application program. The
application's main frame object, and program arguments table, may be
named whatever you like.
Although the above code produces a running application: it starts in
the background; has an empty frame; is identified by the program's
file name on the List page; does nothing and cannot be closed on a
monitor (Ctrl+Alt+X can be used on the terminal. It is a base frame
window to extend upon with the application functionality.
While the contents of the frame can be organized however desired,
typically a title bar and close button are added. These can be added
by a call to the frame's dress
method, with a string value parameter of the initial title for the
frame. This string is also set as the frame window's text value (as
with set_text).
The frame window's text value is used by the List page to identify
the application. Typically the title bar text and List page entry
would be the same. If different values are desired then call the
frame's set_text method after dress, and
set_title,
with the desired value. The close button event's are handled by the
system.
See Application
Writing, WIN.