<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Newt Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="函数参考" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="syslog" HREF="function.syslog.html"><LINK REL="NEXT" TITLE="newt_bell" HREF="function.newt-bell.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.syslog.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.newt-bell.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.newt" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CIII. Newt Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN150078" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="newt.intro" >简介</A ></H1 ><P > 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. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="newt.requirements" >需求</A ></H1 ><P > This module uses the functions of the RedHat Newt library. You need libnewt version >= 0.51.0. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="newt.installation" >安装</A ></H1 ><P > 本 <A HREF="http://pecl.php.net" TARGET="_top" >PECL</A > 扩展未绑定于 PHP 中。 安装此 PECL 扩展库的信息可在手册中标题为 <A HREF="install.pecl.html" >PECL 扩展库安装</A >的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到: <A HREF="http://pecl.php.net/package/newt" TARGET="_top" >http://pecl.php.net/package/newt</A >. </P ><P > 在 PHP 4 中本 <ACRONYM CLASS="acronym" >PECL</ACRONYM > 扩展的源程序位于 PHP 源程序中的 <TT CLASS="filename" >ext/</TT > 目录下或者在上面的 <ACRONYM CLASS="acronym" >PECL</ACRONYM > 连接中。 In order to use these functions you must compile CGI or CLI PHP with newt support by using the <CODE CLASS="option" >--with-newt[=DIR]</CODE > configure option. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > This extension is not available for Windows platform. </P ><P > You may need also <TT CLASS="literal" >curses</TT > and <TT CLASS="literal" >slang</TT > libraries, in order to compile this extension. To specify locations of these libraries, use the following configuration options: <TT CLASS="literal" >--with-curses-dir=/path/to/libcurses</TT > <TT CLASS="literal" >--with-slang-dir=/path/to/libslang</TT > </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="newt.resources" >资源类型</A ></H1 ><P > 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: <A HREF="function.newt-button.html" ><B CLASS="function" >newt_button()</B ></A >) Resource type "newt grid" is a special link identifier for components, returned by newt grid factory functions (for example: <A HREF="function.newt-create-grid.html" ><B CLASS="function" >newt_create_grid()</B ></A >) </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="newt.constants" >预定义常量</A ></H1 ><P >以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。</P ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.reasons" >Newt form exit reasons</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150113" ></A ><P ><B >表 1. Newt form exit reasons</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_EXIT_HOTKEY</B ></TT ></TD ><TD >hotkey defined by <A HREF="function.newt-form-add-hot-key.html" ><B CLASS="function" >newt_form_add_hot_key()</B ></A > was pressed</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_EXIT_COMPONENT</B ></TT ></TD ><TD >some component has caused form to exit</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_EXIT_FDREADY</B ></TT ></TD ><TD >file descriptor specified in <A HREF="function.newt-form-watch-fd.html" ><B CLASS="function" >newt_form_watch_fd()</B ></A > is ready to be read or written to</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_EXIT_TIMER</B ></TT ></TD ><TD >time specified in <A HREF="function.newt-form-set-timer.html" ><B CLASS="function" >newt_form_set_timer()</B ></A > has elapsed</TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.colorsets" >Newt colorsets</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150142" ></A ><P ><B >表 2. Newt colorsets</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ROOT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_BORDER</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_WINDOW</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_SHADOW</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_TITLE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_BUTTON</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ACTBUTTON</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_CHECKBOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ACTCHECKBOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ENTRY</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_LABEL</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_LISTBOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ACTLISTBOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_TEXTBOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ACTTEXTBOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_HELPLINE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ROOTTEXT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ROOTTEXT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_EMPTYSCALE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_FULLSCALE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_DISENTRY</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_COMPACTBUTTON</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_ACTSELLISTBOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_COLORSET_SELLISTBOX</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.args_flags" >Newt argument flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150248" ></A ><P ><B >表 3. Newt argument flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ARG_LAST</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ARG_APPEND</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.sense_flags" >Newt Flags Sense</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150266" ></A ><P ><B >表 4. Newt Flags Sense</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAGS_SET</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAGS_RESET</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAGS_TOGGLE</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.components_flags" >Newt Components Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150288" ></A ><P ><B >表 5. Newt Components Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_RETURNEXIT</B ></TT ></TD ><TD >Exit form, when component is activated</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_HIDDEN</B ></TT ></TD ><TD >Component is hidden</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_SCROLL</B ></TT ></TD ><TD >Component is scrollable</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_DISABLED</B ></TT ></TD ><TD >Component is disabled</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_BORDER</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_WRAP</B ></TT ></TD ><TD >Wrap text</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_NOF12</B ></TT ></TD ><TD >Don't exit form on pressing F12</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_MULTIPLE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_SELECTED</B ></TT ></TD ><TD >Component is selected</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_CHECKBOX</B ></TT ></TD ><TD >Component is checkbox</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_PASSWORD</B ></TT ></TD ><TD >Entry component is password entry</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FLAG_SHOWCURSOR</B ></TT ></TD ><TD >Show cursor</TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.fd_flags" >File Descriptor Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150346" ></A ><P ><B >表 6. File Descriptor Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FD_READ</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FD_WRITE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FD_EXCEPT</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.cbtree_flags" >Checkbox Tree Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150368" ></A ><P ><B >表 7. Checkbox Tree Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_CHECKBOXTREE_UNSELECTABLE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_CHECKBOXTREE_HIDE_BOX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_CHECKBOXTREE_COLLAPSED</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_CHECKBOXTREE_EXPANDED</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_CHECKBOXTREE_UNSELECTED</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_CHECKBOXTREE_SELECTED</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.entry_flags" >Entry Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150402" ></A ><P ><B >表 8. Entry Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ENTRY_SCROLL</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ENTRY_HIDDEN</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ENTRY_RETURNEXIT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ENTRY_DISABLED</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.listbox_flags" >Listbox Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150428" ></A ><P ><B >表 9. Listbox Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_LISTBOX_RETURNEXIT</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.textbox_flags" >Textbox Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150442" ></A ><P ><B >表 10. Textbox Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_TEXTBOX_WRAP</B ></TT ></TD ><TD >Wrap text in the textbox</TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_TEXTBOX_SCROLL</B ></TT ></TD ><TD >Scroll text in the textbox</TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.form_flags" >Form Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150460" ></A ><P ><B >表 11. Form Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_FORM_NOF12</B ></TT ></TD ><TD >Don't exit form on F12 press</TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.keys" >Newt Keys</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150474" ></A ><P ><B >表 12. Newt Keys</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_TAB</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_ENTER</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_SUSPEND</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_ESCAPE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_RETURN</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_EXTRA_BASE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_UP</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_DOWN</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_LEFT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_RIGHT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_BKSPC</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_DELETE</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_HOME</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_END</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_UNTAB</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_PGUP</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_PGDN</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_INSERT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F1</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F2</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F3</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F4</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F5</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F6</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F7</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F8</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F9</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F10</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F11</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_F12</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_KEY_RESIZE</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.anchor" >Newt Anchors</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150608" ></A ><P ><B >表 13. Newt Anchors</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ANCHOR_LEFT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ANCHOR_RIGHT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ANCHOR_TOP</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_ANCHOR_BOTTOM</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H2 CLASS="section" ><A NAME="constants.newt.grid_flags" >Grid Flags</A ></H2 ><DIV CLASS="table" ><A NAME="AEN150634" ></A ><P ><B >表 14. Grid Flags</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constant</TH ><TH >meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="constant" ><B >NEWT_GRID_FLAG_GROWX</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_GRID_FLAG_GROWY</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_GRID_EMPTY</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_GRID_COMPONENT</B ></TT ></TD ><TD > </TD ></TR ><TR ><TD ><TT CLASS="constant" ><B >NEWT_GRID_SUBGRID</B ></TT ></TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="newt.examples" >范例</A ></H1 ><P > This example is a PHP port of RedHat 'setup' utility dialog, executed in text mode. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN150665" ></A ><P ><B >例 1. Newt Usage Example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> newt_init </font><font color="#007700">();<br /> </font><font color="#0000BB">newt_cls </font><font color="#007700">();<br /> <br /> </font><font color="#0000BB">newt_draw_root_text </font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#DD0000">"Test Mode Setup Utility 1.12"</font><font color="#007700">);<br /> </font><font color="#0000BB">newt_push_help_line </font><font color="#007700">(</font><font color="#0000BB">null</font><font color="#007700">);<br /> </font><font color="#0000BB">newt_draw_root_text </font><font color="#007700">(-</font><font color="#0000BB">30</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#DD0000">"(c) 1999-2002 RedHat, Inc"</font><font color="#007700">);<br /><br /> </font><font color="#0000BB">newt_get_screen_size </font><font color="#007700">(&</font><font color="#0000BB">$rows</font><font color="#007700">, &</font><font color="#0000BB">$cols</font><font color="#007700">);<br /> <br /> </font><font color="#0000BB">newt_open_window </font><font color="#007700">(</font><font color="#0000BB">$rows</font><font color="#007700">/</font><font color="#0000BB">2</font><font color="#007700">-</font><font color="#0000BB">17</font><font color="#007700">, </font><font color="#0000BB">$cols</font><font color="#007700">/</font><font color="#0000BB">2</font><font color="#007700">-</font><font color="#0000BB">10</font><font color="#007700">, </font><font color="#0000BB">34</font><font color="#007700">, </font><font color="#0000BB">17</font><font color="#007700">, </font><font color="#DD0000">"Choose a Tool"</font><font color="#007700">);<br /><br /> </font><font color="#0000BB">$form </font><font color="#007700">= </font><font color="#0000BB">newt_form </font><font color="#007700">();<br /><br /> </font><font color="#0000BB">$list </font><font color="#007700">= </font><font color="#0000BB">newt_listbox </font><font color="#007700">(</font><font color="#0000BB">3</font><font color="#007700">, </font><font color="#0000BB">2</font><font color="#007700">, </font><font color="#0000BB">10</font><font color="#007700">);<br /> <br /> foreach (array (<br /> </font><font color="#DD0000">"Authentication configuration"</font><font color="#007700">,<br /> </font><font color="#DD0000">"Firewall configuration"</font><font color="#007700">,<br /> </font><font color="#DD0000">"Mouse configuration"</font><font color="#007700">,<br /> </font><font color="#DD0000">"Network configuration"</font><font color="#007700">,<br /> </font><font color="#DD0000">"Printer configuration"</font><font color="#007700">,<br /> </font><font color="#DD0000">"System services"</font><font color="#007700">) as </font><font color="#0000BB">$l_item</font><font color="#007700">)<br /> {<br /> </font><font color="#0000BB">newt_listbox_add_entry </font><font color="#007700">(</font><font color="#0000BB">$list</font><font color="#007700">, </font><font color="#0000BB">$l_item</font><font color="#007700">, </font><font color="#0000BB">$l_item</font><font color="#007700">);<br /> }<br /><br /> </font><font color="#0000BB">$b1 </font><font color="#007700">= </font><font color="#0000BB">newt_button </font><font color="#007700">(</font><font color="#0000BB">5</font><font color="#007700">, </font><font color="#0000BB">12</font><font color="#007700">, </font><font color="#DD0000">"Run Tool"</font><font color="#007700">);<br /> </font><font color="#0000BB">$b2 </font><font color="#007700">= </font><font color="#0000BB">newt_button </font><font color="#007700">(</font><font color="#0000BB">21</font><font color="#007700">, </font><font color="#0000BB">12</font><font color="#007700">, </font><font color="#DD0000">"Quit"</font><font color="#007700">);<br /> <br /> </font><font color="#0000BB">newt_form_add_component </font><font color="#007700">(</font><font color="#0000BB">$form</font><font color="#007700">, </font><font color="#0000BB">$list</font><font color="#007700">);<br /> </font><font color="#0000BB">newt_form_add_components </font><font color="#007700">(</font><font color="#0000BB">$form</font><font color="#007700">, array(</font><font color="#0000BB">$b1</font><font color="#007700">, </font><font color="#0000BB">$b2</font><font color="#007700">));<br /><br /> </font><font color="#0000BB">newt_refresh </font><font color="#007700">();<br /> </font><font color="#0000BB">newt_run_form </font><font color="#007700">(</font><font color="#0000BB">$form</font><font color="#007700">);<br /><br /> </font><font color="#0000BB">newt_pop_window </font><font color="#007700">();<br /> </font><font color="#0000BB">newt_pop_help_line </font><font color="#007700">();<br /> </font><font color="#0000BB">newt_finished </font><font color="#007700">();<br /> </font><font color="#0000BB">newt_form_destroy </font><font color="#007700">(</font><font color="#0000BB">$form</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >目录</B ></DT ><DT ><A HREF="function.newt-bell.html" >newt_bell</A > -- Send a beep to the terminal</DT ><DT ><A HREF="function.newt-button-bar.html" >newt_button_bar</A > -- </DT ><DT ><A HREF="function.newt-button.html" >newt_button</A > -- Create a new button</DT ><DT ><A HREF="function.newt-centered-window.html" >newt_centered_window</A > -- Open a centered window of the specified size</DT ><DT ><A HREF="function.newt-checkbox-get-value.html" >newt_checkbox_get_value</A > -- </DT ><DT ><A HREF="function.newt-checkbox-set-flags.html" >newt_checkbox_set_flags</A > -- </DT ><DT ><A HREF="function.newt-checkbox-set-value.html" >newt_checkbox_set_value</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-add-item.html" >newt_checkbox_tree_add_item</A > -- *</DT ><DT ><A HREF="function.newt-checkbox-tree-find-item.html" >newt_checkbox_tree_find_item</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-get-current.html" >newt_checkbox_tree_get_current</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-get-entry-value.html" >newt_checkbox_tree_get_entry_value</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-get-multi-selection.html" >newt_checkbox_tree_get_multi_selection</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-get-selection.html" >newt_checkbox_tree_get_selection</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-multi.html" >newt_checkbox_tree_multi</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-set-current.html" >newt_checkbox_tree_set_current</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-set-entry-value.html" >newt_checkbox_tree_set_entry_value</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-set-entry.html" >newt_checkbox_tree_set_entry</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree-set-width.html" >newt_checkbox_tree_set_width</A > -- </DT ><DT ><A HREF="function.newt-checkbox-tree.html" >newt_checkbox_tree</A > -- </DT ><DT ><A HREF="function.newt-checkbox.html" >newt_checkbox</A > -- </DT ><DT ><A HREF="function.newt-clear-key-buffer.html" >newt_clear_key_buffer</A > -- Discards the contents of the terminal's input buffer without waiting for additional input</DT ><DT ><A HREF="function.newt-cls.html" >newt_cls</A > -- </DT ><DT ><A HREF="function.newt-compact-button.html" >newt_compact_button</A > -- </DT ><DT ><A HREF="function.newt-component-add-callback.html" >newt_component_add_callback</A > -- </DT ><DT ><A HREF="function.newt-component-takes-focus.html" >newt_component_takes_focus</A > -- </DT ><DT ><A HREF="function.newt-create-grid.html" >newt_create_grid</A > -- </DT ><DT ><A HREF="function.newt-cursor-off.html" >newt_cursor_off</A > -- </DT ><DT ><A HREF="function.newt-cursor-on.html" >newt_cursor_on</A > -- </DT ><DT ><A HREF="function.newt-delay.html" >newt_delay</A > -- </DT ><DT ><A HREF="function.newt-draw-form.html" >newt_draw_form</A > -- </DT ><DT ><A HREF="function.newt-draw-root-text.html" >newt_draw_root_text</A > -- Displays the string text at the position indicated</DT ><DT ><A HREF="function.newt-entry-get-value.html" >newt_entry_get_value</A > -- </DT ><DT ><A HREF="function.newt-entry-set-filter.html" >newt_entry_set_filter</A > -- </DT ><DT ><A HREF="function.newt-entry-set-flags.html" >newt_entry_set_flags</A > -- </DT ><DT ><A HREF="function.newt-entry-set.html" >newt_entry_set</A > -- </DT ><DT ><A HREF="function.newt-entry.html" >newt_entry</A > -- </DT ><DT ><A HREF="function.newt-finished.html" >newt_finished</A > -- Uninitializes newt interface</DT ><DT ><A HREF="function.newt-form-add-component.html" >newt_form_add_component</A > -- Adds a single component to the form</DT ><DT ><A HREF="function.newt-form-add-components.html" >newt_form_add_components</A > -- Add several components to the form</DT ><DT ><A HREF="function.newt-form-add-hot-key.html" >newt_form_add_hot_key</A > -- </DT ><DT ><A HREF="function.newt-form-destroy.html" >newt_form_destroy</A > -- Destroys a form</DT ><DT ><A HREF="function.newt-form-get-current.html" >newt_form_get_current</A > -- </DT ><DT ><A HREF="function.newt-form-run.html" >newt_form_run</A > -- Runs a form</DT ><DT ><A HREF="function.newt-form-set-background.html" >newt_form_set_background</A > -- </DT ><DT ><A HREF="function.newt-form-set-height.html" >newt_form_set_height</A > -- </DT ><DT ><A HREF="function.newt-form-set-size.html" >newt_form_set_size</A > -- </DT ><DT ><A HREF="function.newt-form-set-timer.html" >newt_form_set_timer</A > -- </DT ><DT ><A HREF="function.newt-form-set-width.html" >newt_form_set_width</A > -- </DT ><DT ><A HREF="function.newt-form-watch-fd.html" >newt_form_watch_fd</A > -- </DT ><DT ><A HREF="function.newt-form.html" >newt_form</A > -- Create a form</DT ><DT ><A HREF="function.newt-get-screen-size.html" >newt_get_screen_size</A > -- Fills in the passed references with the current size of the terminal</DT ><DT ><A HREF="function.newt-grid-add-components-to-form.html" >newt_grid_add_components_to_form</A > -- </DT ><DT ><A HREF="function.newt-grid-basic-window.html" >newt_grid_basic_window</A > -- </DT ><DT ><A HREF="function.newt-grid-free.html" >newt_grid_free</A > -- </DT ><DT ><A HREF="function.newt-grid-get-size.html" >newt_grid_get_size</A > -- </DT ><DT ><A HREF="function.newt-grid-h-close-stacked.html" >newt_grid_h_close_stacked</A > -- </DT ><DT ><A HREF="function.newt-grid-h-stacked.html" >newt_grid_h_stacked</A > -- </DT ><DT ><A HREF="function.newt-grid-place.html" >newt_grid_place</A > -- </DT ><DT ><A HREF="function.newt-grid-set-field.html" >newt_grid_set_field</A > -- </DT ><DT ><A HREF="function.newt-grid-simple-window.html" >newt_grid_simple_window</A > -- </DT ><DT ><A HREF="function.newt-grid-v-close-stacked.html" >newt_grid_v_close_stacked</A > -- </DT ><DT ><A HREF="function.newt-grid-v-stacked.html" >newt_grid_v_stacked</A > -- </DT ><DT ><A HREF="function.newt-grid-wrapped-window-at.html" >newt_grid_wrapped_window_at</A > -- </DT ><DT ><A HREF="function.newt-grid-wrapped-window.html" >newt_grid_wrapped_window</A > -- </DT ><DT ><A HREF="function.newt-init.html" >newt_init</A > -- Initialize newt</DT ><DT ><A HREF="function.newt-label-set-text.html" >newt_label_set_text</A > -- </DT ><DT ><A HREF="function.newt-label.html" >newt_label</A > -- </DT ><DT ><A HREF="function.newt-listbox-append-entry.html" >newt_listbox_append_entry</A > -- </DT ><DT ><A HREF="function.newt-listbox-clear-selection.html" >newt_listbox_clear_selection</A > -- </DT ><DT ><A HREF="function.newt-listbox-clear.html" >newt_listbox_clear</A > -- </DT ><DT ><A HREF="function.newt-listbox-delete-entry.html" >newt_listbox_delete_entry</A > -- </DT ><DT ><A HREF="function.newt-listbox-get-current.html" >newt_listbox_get_current</A > -- </DT ><DT ><A HREF="function.newt-listbox-get-selection.html" >newt_listbox_get_selection</A > -- </DT ><DT ><A HREF="function.newt-listbox-insert-entry.html" >newt_listbox_insert_entry</A > -- </DT ><DT ><A HREF="function.newt-listbox-item-count.html" >newt_listbox_item_count</A > -- </DT ><DT ><A HREF="function.newt-listbox-select-item.html" >newt_listbox_select_item</A > -- </DT ><DT ><A HREF="function.newt-listbox-set-current-by-key.html" >newt_listbox_set_current_by_key</A > -- </DT ><DT ><A HREF="function.newt-listbox-set-current.html" >newt_listbox_set_current</A > -- </DT ><DT ><A HREF="function.newt-listbox-set-data.html" >newt_listbox_set_data</A > -- </DT ><DT ><A HREF="function.newt-listbox-set-entry.html" >newt_listbox_set_entry</A > -- </DT ><DT ><A HREF="function.newt-listbox-set-width.html" >newt_listbox_set_width</A > -- </DT ><DT ><A HREF="function.newt-listbox.html" >newt_listbox</A > -- </DT ><DT ><A HREF="function.newt-listitem-get-data.html" >newt_listitem_get_data</A > -- </DT ><DT ><A HREF="function.newt-listitem-set.html" >newt_listitem_set</A > -- </DT ><DT ><A HREF="function.newt-listitem.html" >newt_listitem</A > -- </DT ><DT ><A HREF="function.newt-open-window.html" >newt_open_window</A > -- Open a window of the specified size and position</DT ><DT ><A HREF="function.newt-pop-help-line.html" >newt_pop_help_line</A > -- Replaces the current help line with the one from the stack</DT ><DT ><A HREF="function.newt-pop-window.html" >newt_pop_window</A > -- Removes the top window from the display</DT ><DT ><A HREF="function.newt-push-help-line.html" >newt_push_help_line</A > -- Saves the current help line on a stack, and displays the new line</DT ><DT ><A HREF="function.newt-radio-get-current.html" >newt_radio_get_current</A > -- </DT ><DT ><A HREF="function.newt-radiobutton.html" >newt_radiobutton</A > -- </DT ><DT ><A HREF="function.newt-redraw-help-line.html" >newt_redraw_help_line</A > -- </DT ><DT ><A HREF="function.newt-reflow-text.html" >newt_reflow_text</A > -- </DT ><DT ><A HREF="function.newt-refresh.html" >newt_refresh</A > -- Updates modified portions of the screen</DT ><DT ><A HREF="function.newt-resize-screen.html" >newt_resize_screen</A > -- </DT ><DT ><A HREF="function.newt-resume.html" >newt_resume</A > -- Resume using the newt interface after calling <A HREF="function.newt-suspend.html" ><B CLASS="function" >newt_suspend()</B ></A ></DT ><DT ><A HREF="function.newt-run-form.html" >newt_run_form</A > -- Runs a form</DT ><DT ><A HREF="function.newt-scale-set.html" >newt_scale_set</A > -- </DT ><DT ><A HREF="function.newt-scale.html" >newt_scale</A > -- </DT ><DT ><A HREF="function.newt-scrollbar-set.html" >newt_scrollbar_set</A > -- </DT ><DT ><A HREF="function.newt-set-help-callback.html" >newt_set_help_callback</A > -- </DT ><DT ><A HREF="function.newt-set-suspend-callback.html" >newt_set_suspend_callback</A > -- Set a callback function which gets invoked when user presses the suspend key</DT ><DT ><A HREF="function.newt-suspend.html" >newt_suspend</A > -- Tells newt to return the terminal to its initial state</DT ><DT ><A HREF="function.newt-textbox-get-num-lines.html" >newt_textbox_get_num_lines</A > -- </DT ><DT ><A HREF="function.newt-textbox-reflowed.html" >newt_textbox_reflowed</A > -- </DT ><DT ><A HREF="function.newt-textbox-set-height.html" >newt_textbox_set_height</A > -- </DT ><DT ><A HREF="function.newt-textbox-set-text.html" >newt_textbox_set_text</A > -- </DT ><DT ><A HREF="function.newt-textbox.html" >newt_textbox</A > -- </DT ><DT ><A HREF="function.newt-vertical-scrollbar.html" >newt_vertical_scrollbar</A > -- </DT ><DT ><A HREF="function.newt-wait-for-key.html" >newt_wait_for_key</A > -- Doesn't return until a key has been pressed</DT ><DT ><A HREF="function.newt-win-choice.html" >newt_win_choice</A > -- </DT ><DT ><A HREF="function.newt-win-entries.html" >newt_win_entries</A > -- </DT ><DT ><A HREF="function.newt-win-menu.html" >newt_win_menu</A > -- </DT ><DT ><A HREF="function.newt-win-message.html" >newt_win_message</A > -- </DT ><DT ><A HREF="function.newt-win-messagev.html" >newt_win_messagev</A > -- </DT ><DT ><A HREF="function.newt-win-ternary.html" >newt_win_ternary</A > -- </DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.syslog.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.newt-bell.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >syslog</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >newt_bell</TD ></TR ></TABLE ></DIV ></BODY ></HTML >