This is a PHP language extension for RedHat Newt library, a terminal-based window and widget library for writing applications with user friendly interface. Once this extension is enabled in PHP it will provide the use of Newt widgets, such as windows, buttons, checkboxes, radiobuttons, labels, editboxes, scrolls, textareas, scales, etc. Use of this extension if very similar to the original Newt API of C programming language.
This module uses the functions of the RedHat Newt library. You need libnewt version >= 0.51.0.
This » PECL extension is not bundled with PHP. Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/newt.
In PHP 4 this PECL extensions
source can be found in the
ext/ directory within the
PHP source or at the PECL link above.
In order to use these functions you must compile CGI or CLI PHP with
newt support by using the
This extension is not available for Windows platform.
You may need also
libraries, in order to compile this extension. To specify locations
of these libraries, use the following configuration options:
This extension uses two resource types: "newt component" and "newt grid". Resource type "newt component" is returned by functions, which create common newt widgets (for example: newt_button()) Resource type "newt grid" is a special link identifier for components, returned by newt grid factory functions (for example: newt_create_grid())
The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.
|hotkey defined by newt_form_add_hot_key() was pressed|
|some component has caused form to exit|
|file descriptor specified in newt_form_watch_fd() is ready to be read or written to|
|time specified in newt_form_set_timer() has elapsed|
|Exit form, when component is activated|
|Component is hidden|
|Component is scrollable|
|Component is disabled|
|Don't exit form on pressing F12|
|Component is selected|
|Component is checkbox|
|Entry component is password entry|
|Wrap text in the textbox|
|Scroll text in the textbox|
This example is a PHP port of RedHat 'setup' utility dialog, executed in text mode.
newt_draw_root_text (0, 0, "Test Mode Setup Utility 1.12");
newt_draw_root_text (-30, 0, "(c) 1999-2002 RedHat, Inc");
newt_get_screen_size (&$rows, &$cols);
newt_open_window ($rows/2-17, $cols/2-10, 34, 17, "Choose a Tool");
$form = newt_form ();
$list = newt_listbox (3, 2, 10);
foreach (array (
"System services") as $l_item)
newt_listbox_add_entry ($list, $l_item, $l_item);
$b1 = newt_button (5, 12, "Run Tool");
$b2 = newt_button (21, 12, "Quit");
newt_form_add_component ($form, $list);
newt_form_add_components ($form, array($b1, $b2));
Table of Contents