{"id":52,"date":"2020-07-17T15:10:43","date_gmt":"2020-07-17T15:10:43","guid":{"rendered":"http:\/\/www.freecrt.cn\/?p=52"},"modified":"2023-11-11T08:56:43","modified_gmt":"2023-11-11T08:56:43","slug":"lua-button-bar","status":"publish","type":"post","link":"http:\/\/www.freecrt.cn\/?p=52","title":{"rendered":"FreeCRT \u4e4b Lua Button Bar"},"content":{"rendered":"\n<p>FreeCRT\u5728Button Bar\u4e2d\u5f15\u5165\u4e86Lua\u811a\u672c\u8bed\u8a00\uff0c\u76f8\u5bf9\u4e8eSecureCRT\u7684Button Bar\u5c06\u66f4\u52a0\u7075\u6d3b\uff0c\u5f53\u7136\u4e5f\u66f4\u96be\u9a7e\u9a6d\uff0c\u4f46\u5bf9\u4e8e\u771f\u6b63\u7684\u7a0b\u5e8f\u5458\u6765\u8bf4\uff0c\u4e5f\u8bb8\u5b83\u4f1a\u6210\u4e3a\u4f60\u624b\u4e2d\u7684\u5c60\u9f99\u501a\u5929\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u811a\u672c\u89c4\u5219<\/h2>\n\n\n\n<p>Lua Button Bar\u4ee5\u6df7\u5408\u811a\u672c\u7684\u65b9\u5f0f\u6765\u652f\u6301Lua\u8bed\u8a00\uff0c\u5982\u679c\u4f60\u4e86\u89e3jsp\u6216php\u5728\u7f51\u9875\u5f00\u53d1\u4e2d\u7684\u4f7f\u7528\u65b9\u5f0f\uff0c\u90a3\u4e48\u4f60\u4f1a\u5f88\u8f7b\u677e\u7684\u638c\u63e1Lua Button Bar\u7684\u811a\u672c\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u4f8b\u5b50\uff1a<br><em>plain text<br>plain text<br>&lt;%<br>Lua scripts<br>%&gt;<br>plain text &lt;% Lua scripts %&gt; plain text<br>plain text<\/em><\/p>\n\n\n\n<p>Lua\u811a\u672c\u4ee5&lt;%\u548c%&gt;\u5bf9\u5305\u62ec\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3aLua script block, block\u7684\u6570\u91cf\u4e0d\u53d7\u9650\u5236\u3002block\u4f1a\u4f9d\u6b21\u6267\u884c\uff0c\u5982\u679c\u5728\u4e4b\u524d\u7684block\u58f0\u660e\u4e86\u5168\u5c40\u7684\u7b26\u53f7\uff08\u53d8\u91cf\u6216\u51fd\u6570\uff09\uff0c\u540e\u7eed\u7684block\u53ef\u4ee5\u5b89\u5168\u5f15\u7528\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lua\u5e93\u5c4f\u853d<\/h2>\n\n\n\n<p>Lua\u7684\u5f15\u5165\uff0c\u53ea\u662f\u4e3a\u4e86\u89e3\u51b3Button Bar\u7f3a\u5c11\u52a8\u6001\u751f\u6210\u811a\u672c\u7684\u80fd\u529b\uff0c\u5bf9\u4e8eLua\u5e93\u81ea\u5e26\u7684\u4e00\u4e9b\u7cfb\u7edf\u6027API\uff0c\u5982\u6587\u4ef6\u7684\u5220\u9664\u3001\u6539\u540d\uff0c\u8bfb\u5199\u7b49\uff0c\u4e3a\u5b89\u5168\u8d77\u89c1\u5168\u90e8\u5c01\u95ed\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u65b0\u5f15\u5165API &#8211; nprint<\/h2>\n\n\n\n<p>nprint\u53ea\u662f\u5bf9print API\u7684\u4fee\u6539\uff0c\u53ef\u4ee5\u8bfb\u4f5cno line feed print\uff0c\u4e0d\u6362\u884c\u6253\u5370\u3002\u53e6\u5916\u8f93\u51fa\u7684\u5143\u7d20\u4e4b\u95f4\u4e0d\u4f1a\u9ed8\u8ba4\u63d2\u5165\u7684\u5236\u8868\u7b26\u3002\u9664\u6b64\u4ee5\u5916\uff0c\u5b83\u7684\u884c\u4e3a\u4e0eprint\u5b8c\u5168\u4e00\u81f4\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"> \u65b0\u5f15\u5165API &#8211; dialog<\/h2>\n\n\n\n<p>API dialog\u7684\u5f00\u53d1\u662f\u6211\u5f15\u5165Lua\u8bed\u8a00\u7684\u6700\u76f4\u63a5\u52a8\u673a\u3002\u6211\u5e0c\u671b\u7528\u6237\u5728\u70b9\u51fbButton Bar\u6309\u94ae\u7684\u65f6\u5019\uff0c\u80fd\u591f\u5f39\u51fa\u5bf9\u8bdd\u6846\uff0c\u63a5\u53d7\u7528\u6237\u7684\u8f93\u5165\uff0c\u518d\u52a8\u6001\u7684\u4ea7\u751f\u811a\u672c\u3002\u867d\u7136\u5b9e\u73b0\u4e0a\u6709\u70b9\u590d\u6742\uff0c\u540c\u65f6Lua\u5bf9table\u7684\u64cd\u4f5c\u4e5f\u4e0d\u5982javascript\u7b80\u5355\uff0c\u4f46\u8fd8\u662f\u505a\u5230\u4e86\u3002<\/p>\n\n\n\n<p><em>API\u539f\u578b<\/em>\uff1abool dialog(param)<br><em>\u8f93\u5165\u53c2\u6570<\/em>\uff1atable\u7c7b\u578b\u7684\u53c2\u6570\uff0c\u7528\u4e8e\u6784\u5efa\u7528\u6237\u6240\u9700\u8981\u7684\u5bf9\u8bdd\u6846\uff0c\u6211\u7528table\u683c\u5f0f\u63cf\u8ff0\u5982\u4e0b\uff0c<br>{<br>  [&#8216;title&#8217;]=&#8217;dialog title&#8217;,<br>  [&#8216;items&#8217;]={<br>    {<br>      [&#8216;id&#8217;]=&#8217;name&#8217;,   \/\/ \u6b64id\u7528\u4e8e\u8fd4\u56de\u7528\u6237\u7684\u8f93\u5165\u503c<br>      [&#8216;label&#8217;]=&#8217;input label&#8217;,<br>      [&#8216;type&#8217;]=&#8217;input control type&#8217;,   \/\/ \u652f\u6301\u5217\u8868: edit, droplist, dropdown<br>      [&#8216;options&#8217;]={&#8216;opt1&#8217;, &#8216;opt2&#8217;, &#8216;opt3&#8217;}, \/\/ \u4ec5\u5bf9droplist, dropdown\u6709\u6548<br>      [&#8216;default&#8217;]=&#8217;opt1&#8242;,  \/\/ \u53ef\u9009 \u9ed8\u8ba4\u503c<br>      [&#8216;require&#8217;]=true,  \/\/ \u53ef\u9009 \u9ed8\u8ba4\u4e3afalse\uff0c\u8868\u793a\u662f\u5426\u5fc5\u987b\u6709\u503c<br>    },<br>    {&#8230;},<br>    {&#8230;}<br>  }<br>}<br>\u8fd4\u56de\u503c\uff1aboolean\u7c7b\u578b\uff0c\u5982\u679c\u4e3atrue\u8868\u793a\u7528\u6237\u9009\u62e9\u4e86OK\u952e\uff0c\u8fd4\u56defalse\u8868\u793a\u7528\u6237\u9009\u62e9\u975eOK\u952e\u5173\u95ed\u5bf9\u8bdd\u6846\u3002<br><br>\u5f53\u7528\u6237\u5df2OK\u8fd4\u56de\u65f6\uff0cdialog\u4f1a\u521b\u5efa\u5168\u5c40\u53d8\u91cf\u8fd4\u56de\u7528\u6237\u7684\u8f93\u5165\u6216\u9009\u62e9\u503c\uff08\u5747\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\uff09\uff0c\u53d8\u91cf\u540d\u4e3a\u7528\u6237\u6307\u5b9a\u7684id\u540d\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7_G[id]\u6765\u83b7\u53d6\u503c\u3002<\/p>\n\n\n\n<p><strong> \u7b80\u5355\u7684\u4f8b\u5b50<\/strong><\/p>\n\n\n\n<p>\u4ee5\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u6765\u4f5c\u4e3a\u672c\u6587\u7684\u7ed3\u675f\uff0c<\/p>\n\n\n\n<p>&lt;% <br>para={<br>  [&#8216;title&#8217;]=&#8217;Test Dialog&#8217;, <br>  [&#8216;items&#8217;]={{ <br>    [&#8216;id&#8217;]=&#8217;name&#8217;, <br>    [&#8216;label&#8217;]=&#8217;Name&#8217;, <br>    [&#8216;type&#8217;]=&#8217;edit&#8217;, <br>    [&#8216;default&#8217;]=&#8217;Your Name&#8217;, <br>    [&#8216;required&#8217;]=true <br>  }, { <br>    [&#8216;id&#8217;]=&#8217;sex&#8217;, <br>    [&#8216;label&#8217;]=&#8217;Sex&#8217;, <br>    [&#8216;type&#8217;]=&#8217;droplist&#8217;, <br>    [&#8216;options&#8217;]={&#8216;male&#8217;, &#8216;female&#8217;}, <br>    [&#8216;default&#8217;]=&#8217;female&#8217; <br>  }} <br>} <br><br>if (dialog(para)) then <br>  sex = _G[&#8216;sex&#8217;] <br>  name = _G[&#8216;name&#8217;] <br>  nprint(&#8220;echo &#8216;Your name is &#8220;, name, &#8221; and you are &#8220;, sex, &#8220;!&#8217;\\n&#8221;) <br>end <br>%&gt;<\/p>\n\n\n\n<p>\u6765\u770b\u4e00\u4e0b\u8fd0\u884c\u6548\u679c\uff1a<br><img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"103\" class=\"wp-image-64\" style=\"width: 200px;\" src=\"http:\/\/www.freecrt.cn\/wp-content\/uploads\/2020\/08\/dialog.png\" alt=\"\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>FreeCRT\u5728Button Bar\u4e2d\u5f15\u5165\u4e86Lua\u811a\u672c\u8bed\u8a00\uff0c\u76f8\u5bf9\u4e8eSecureCRT\u7684Button Bar\u5c06\u66f4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=\/wp\/v2\/posts\/52"}],"collection":[{"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=52"}],"version-history":[{"count":6,"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions"}],"predecessor-version":[{"id":756,"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions\/756"}],"wp:attachment":[{"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.freecrt.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}