├── LICENSE ├── README.md ├── carlmvc ├── lib │ ├── carl │ │ ├── ctrl │ │ │ ├── .res │ │ │ │ ├── toolbar.gif │ │ │ │ └── toolbar.psd │ │ │ ├── _.aardio │ │ │ ├── comboboxex.aardio │ │ │ ├── listviewex.aardio │ │ │ ├── page.aardio │ │ │ ├── pageSort.aardio │ │ │ ├── pagectrl.aardio │ │ │ ├── select.aardio │ │ │ ├── tab.aardio │ │ │ ├── toolbar.aardio │ │ │ └── treeviewex.aardio │ │ ├── http.aardio │ │ └── sql.aardio │ └── loadServer.aardio ├── main.aardio ├── main.plugin.aardio └── project │ ├── carlmvc │ ├── .build │ │ └── default.main.aardio │ ├── aardio-cgi │ │ ├── .build │ │ │ ├── default.Manifest.xml │ │ │ ├── default.init.aardio │ │ │ └── default.main.aardio │ │ ├── default.aproj │ │ └── main.aardio │ ├── application │ │ ├── common │ │ │ └── function.aardio │ │ ├── filters │ │ │ └── mvcapp.aardio │ │ └── mvc │ │ │ ├── controller │ │ │ ├── defaultCtl.aardio │ │ │ └── rpcCtl.aardio │ │ │ └── view │ │ │ └── default │ │ │ └── index.aardio │ ├── carlmvc │ │ ├── base.aardio │ │ ├── config.aardio │ │ ├── start.aardio │ │ └── version.aardio │ ├── config │ │ ├── database.aardio │ │ ├── mvcconfig.aardio │ │ ├── rpcconfig.aardio │ │ └── webconfig.aardio │ ├── default.aproj │ ├── lib │ │ ├── carl │ │ │ ├── mssql.aardio │ │ │ ├── mvc │ │ │ │ ├── _.aardio │ │ │ │ ├── client.aardio │ │ │ │ ├── common.aardio │ │ │ │ └── view.aardio │ │ │ ├── mysql.aardio │ │ │ ├── oracle.aardio │ │ │ ├── rpc │ │ │ │ ├── _.aardio │ │ │ │ ├── client.aardio │ │ │ │ └── server.aardio │ │ │ ├── rsa.aardio │ │ │ ├── session.aardio │ │ │ ├── sql.aardio │ │ │ ├── string.aardio │ │ │ └── table.aardio │ │ ├── common │ │ │ ├── _.aardio │ │ │ └── jsTree.aardio │ │ ├── dbase │ │ │ ├── _.aardio │ │ │ ├── base.aardio │ │ │ ├── mssql │ │ │ │ ├── _.aardio │ │ │ │ └── defaultDB.aardio │ │ │ ├── mysql │ │ │ │ ├── _.aardio │ │ │ │ └── defaultDB.aardio │ │ │ ├── page.aardio │ │ │ └── sqlite │ │ │ │ ├── _.aardio │ │ │ │ └── defaultDB.aardio │ │ ├── intellisense.aardio │ │ └── svc │ │ │ ├── _.aardio │ │ │ ├── rpc │ │ │ └── rpcSvc.aardio │ │ │ └── system │ │ │ └── defaultSvc.aardio │ ├── main.aardio │ └── www │ │ ├── index.aardio │ │ └── web.config │ └── template │ └── default │ ├── controller.aardio │ ├── db.aardio │ ├── js.aardio │ ├── svc.aardio │ └── view.aardio └── 插件使用说明.txt /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carlaau/carlmvc/e2cde2f87ddfc447cf8d7c7de17b10df4527be49/README.md -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/.res/toolbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carlaau/carlmvc/e2cde2f87ddfc447cf8d7c7de17b10df4527be49/carlmvc/lib/carl/ctrl/.res/toolbar.gif -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/.res/toolbar.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carlaau/carlmvc/e2cde2f87ddfc447cf8d7c7de17b10df4527be49/carlmvc/lib/carl/ctrl/.res/toolbar.psd -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/_.aardio: -------------------------------------------------------------------------------- 1 | //自定义控件库 2 | namespace carl.ctrl{} 3 | 4 | import carl.ctrl.listviewex; 5 | import carl.ctrl.pagectrl;//分页控件 6 | import carl.ctrl.page; 7 | import carl.ctrl.toolbar; 8 | import carl.ctrl.treeviewex; 9 | import carl.ctrl.comboboxex; 10 | import carl.ctrl.tab; 11 | import carl.ctrl.select; 12 | 13 | /*intellisense() 14 | carl.ctrl = 自定义控件库 15 | end intellisense*/ -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/comboboxex.aardio: -------------------------------------------------------------------------------- 1 | //comboboxex 下拉多选框 2 | namespace carl.ctrl.comboboxex{} 3 | 4 | import win.ui.tracker; 5 | import win.ui.ctrl.metaProperty; 6 | import carl.ctrl.treeviewex; 7 | 8 | namespace win.ui.ctrl; 9 | 10 | class comboboxex{ 11 | ctor(parent,tParam){ 12 | 13 | this = ..win.form(right=100;bottom=25;border="none";exmode="none";mode="child";parent=parent;tParam=tParam) 14 | this.add( 15 | btn={cls="button";text="u";left=82;top=1;right=100;bottom=25;dr=1;dt=1;font=LOGFONT(name='Marlett';charset=2;weight=500);tabstop=1;z=2}; 16 | edit={cls="edit";left=1;top=1;right=82;bottom=25;autohscroll=false;autovscroll=false;dl=1;dr=1;dt=1;edge=1;hidesel=1;readonly=1;z=1} 17 | ) 18 | 19 | this.btn.oncommand = function(id,event){ 20 | this.hideForm(); 21 | } 22 | var winform = ..win.form(right=100;bottom=100;border="none";exmode="none";parent=this); 23 | winform.add(treeview={cls="treeview";left=0;top=0;right=100;bottom=100;ah=1;asel=false;aw=1;bgcolor=16777215;chkBox=1;db=1;dl=1;dr=1;dt=1;edge=1;hscroll=1;singleExpand=false;vscroll=1;z=1}); 24 | this.tvEx = ..win.ui.ctrl.treeviewex(winform.treeview); 25 | this.startFirst = false; 26 | 27 | this.onDestroy = function(){ 28 | winform.close(); 29 | } 30 | 31 | var fromPoint = ::User32.api("WindowFromPoint", "int(int x, int y)"); 32 | 33 | ..win.ui.tracker(this.btn).onMouseLeave = function(wParam,lParam){ 34 | while(true){ 35 | var hwnd = fromPoint(..win.getMessagePos()); 36 | if(hwnd != winform.treeview.hwnd && hwnd != this.edit.hwnd){ 37 | if(this.isShow) this.hideForm(); 38 | break ; 39 | } 40 | ..win.delay(200) 41 | } 42 | } 43 | }; 44 | 45 | onCreate = function(){ 46 | this.tvEx.exCheckBoxesChanged = function(hItem, checked){//选中事件 47 | var tab = this.tvEx.getItemData(hItem); 48 | if(tab) tab.checked = checked; 49 | 50 | var t = {}; 51 | this.tvEx.enum( 52 | function(hItem,parent){ 53 | var tab = this.tvEx.getItemData(hItem); 54 | var child = false; 55 | for h in this.tvEx.each(hItem){ 56 | child = true; 57 | break ; 58 | } 59 | if(tab && tab.checked && !child) table.push(t,tab.text) 60 | } 61 | ) 62 | this.edit.text = string.join(t,";"); 63 | this.text = this.edit.text; 64 | } 65 | this.tvEx.onnotify = function(id,code,ptr) { 66 | /*响应通知*/ 67 | return this.tvEx.exOnnotify(id,code,ptr); 68 | }; 69 | this.edit.text = this.text; 70 | } 71 | 72 | hideForm = function(){ 73 | var show = this.btn.text=="u" ? true : false; 74 | this.btn.text = this.btn.text=="u" ? "t" : "u"; 75 | var x,y,cx,cy = ..win.getPos(this.hwnd,true); 76 | winform.setPos(x,y+cy-2,cx,200); 77 | winform.show(show); 78 | if(show && !this.startFirst){ 79 | ..win.delay(200); 80 | this.setChecked(); 81 | this.startFirst = true; 82 | } 83 | this.isShow = show; 84 | } 85 | 86 | insertItem = function(...){ 87 | this.tvEx.insertItem(...); 88 | this.tvEx.exExpandAll(); 89 | this.edit.text = this.text; 90 | this.setChecked(); 91 | this.tvEx.ensureVisible(this.tvEx.getFirst()) 92 | } 93 | 94 | setChecked = function(){ 95 | var tabchecked = string.split(this.text,";"); 96 | this.tvEx.enum( 97 | function(hItem,parent){ 98 | var tab = this.tvEx.getItemData(hItem); 99 | if(tab){ 100 | if(table.find(tabchecked,tab.text)){ 101 | tab.checked = true; 102 | this.tvEx.setChecked(hItem,true) 103 | }else { 104 | tab.checked = false; 105 | this.tvEx.setChecked(hItem,false) 106 | } 107 | } 108 | } 109 | ) 110 | } 111 | 112 | getChecked = function(key){ 113 | var t = {}; 114 | this.tvEx.enum( 115 | function(hItem,parent){ 116 | var tab = this.tvEx.getItemData(hItem); 117 | if(tab && tab.checked){ 118 | var tc = table.clone(tab); 119 | for(i=1;#tc;1) table.remove(tc); 120 | if(key){ 121 | table.push(t,tc[key]) 122 | }else { 123 | table.push(t,tc) 124 | } 125 | } 126 | } 127 | ) 128 | return t; 129 | } 130 | 131 | getKey = function(key){ 132 | var t = {}; 133 | this.tvEx.enum( 134 | function(hItem,parent){ 135 | var tab = this.tvEx.getItemData(hItem); 136 | if(tab){ 137 | var tc = table.clone(tab); 138 | for(i=1;#tc;1) table.remove(tc); 139 | if(key){ 140 | table.push(t,tc[key]) 141 | }else { 142 | table.push(t,tc) 143 | } 144 | } 145 | } 146 | ) 147 | return t; 148 | } 149 | 150 | 151 | } 152 | 153 | namespace comboboxex{ 154 | string = ..string; 155 | table = ..table; 156 | } 157 | 158 | /*intellisense() 159 | win.ui.ctrl.comboboxex = 下拉多选控件 160 | win.ui.ctrl.comboboxex() = 下拉多选控件 161 | ?win.ui.ctrl.comboboxex = !comboboxex. 162 | !comboboxex.insertItem(table对像) = table对象,用法与treeview.insertItem一样, 163 | !comboboxex.getChecked() = 返回所有选中项table对像 164 | !comboboxex.getChecked(key) = 返回所有选中项key值table对像 165 | !comboboxex.getKey() = 返回全部项table对像 166 | !comboboxex.getKey(key) = 返回全部项key值table对像 167 | end intellisense*/ 168 | -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/page.aardio: -------------------------------------------------------------------------------- 1 | //page 整页控件 2 | //由listview扩展控件和pagectrl分页控件组成 3 | namespace carl.ctrl.page{} 4 | 5 | import win.cur; 6 | import carl.sql; 7 | import util.metaProperty; 8 | import process; 9 | 10 | namespace win.ui.ctrl; 11 | class page { 12 | ctor(parent,tParam){ 13 | this = ..win.form(text="aardio form";right=900;bottom=400;border="none";exmode="none";mode="child";parent=parent;tParam=tParam) 14 | this.add( 15 | btnSort={cls="static";text="设置列名";left=713;top=380;right=767;bottom=396;color=16711680;db=1;dl=1;notify=1;transparent=1;z=3}; 16 | lvex={cls="listviewex";text="listview扩展控件";left=0;top=0;right=900;bottom=375;db=1;dl=1;dr=1;dt=1;edge=1;transparent=1;z=2}; 17 | pagectrl={cls="pagectrl";text="分页控件";left=0;top=375;right=706;bottom=400;db=1;dl=1;edge=1;transparent=1;z=1}; 18 | txtMsg={cls="static";left=775;top=380;right=899;bottom=396;bgcolor=15780518;color=32768;db=1;dl=1;dr=1;transparent=1;z=4} 19 | ) 20 | 21 | this.pagectrl.listview(this.lvex.listview); 22 | 23 | this.pagectrl.showPage = function(){//分页绑定函数 24 | if( this.ShowPageStatus ){return ; } 25 | this.ShowPageStatus = true; 26 | try{ 27 | this.executeSql(this.pagectrl.nowPage, this.pagectrl.pageSize); 28 | } 29 | catch(e){ 30 | ..io.print(e) 31 | } 32 | this.ShowPageStatus = null; 33 | } 34 | 35 | this.btnSort.oncommand = function(id,event){ 36 | var form = this.loadForm($"~/lib/carl/ctrl/pageSort.aardio"); 37 | form.doModal(this.parent) 38 | } 39 | 40 | this.btnSort.wndproc = function(hwnd,message,wParam,lParam){ 41 | if(message = 0x200/*_WM_MOUSEMOVE*/ or message = 0x202/*_WM_LBUTTONUP*/) 42 | ..win.cur.setCur(hwndmouse);//鼠标形状变成手状 43 | } 44 | 45 | this.pagectrl.selected = function(){ 46 | if(this.selected) this.selected(); 47 | } 48 | this.isPage = true;//是否分页 49 | this.sortFilePath = "/config/sortTable.table"; 50 | ..table.mix(this@, _metaProperty); 51 | } 52 | 53 | listview = function(){ 54 | return this.lvex.listview; 55 | } 56 | 57 | listviewEx = function(){ 58 | return this.lvex; 59 | } 60 | 61 | executeSql = function(currentPage, pageSize){ 62 | this.lvex.clearRow(); 63 | var tab,err; 64 | if(this.getTable){ 65 | tab,err = this.getTable(currentPage, pageSize); 66 | if(tab === false) return false; 67 | }else { 68 | if( ! this.sql ){ 69 | this.msgboxErr("请设置page控件SQL语句","提示") 70 | return ; 71 | } 72 | var where = ""; 73 | if( type(this.where) == "function" ){//自定义查询语句 74 | where = this.where(); 75 | } 76 | if(where === false) return false; 77 | where = #where ? "where " + where : ""; 78 | var sql; 79 | if(this.isPage){ 80 | var drive = this.drive : ..config[["__drive"]] : "mysql"; 81 | sql = (drive == "mysql") ? 82 | ..carl.sql.my.getPageSql(this.sql + " " + where, currentPage, pageSize, this.orderby) : 83 | ..carl.sql.ms.getPageSql(this.sql + " " + where, currentPage, pageSize, this.orderby); 84 | }else { 85 | sql = this.sql ++ " " ++ where; 86 | if(#this.orderby) sql += " order by " ++ this.orderby; 87 | } 88 | this.lastSql = sql; 89 | tab,err = this.webService.getTable(sql) 90 | } 91 | if( !tab ){ 92 | this.msgbox(err,"提示") 93 | return ; 94 | } 95 | if( #tab ){ 96 | if( this.isPage ){ 97 | this.pagectrl.totalCount = tab[1]["rowCount"];//总记录 98 | }else { 99 | this.pagectrl.pageSize = #tab 100 | this.pagectrl.totalCount = #tab; 101 | } 102 | if(!this.table){ 103 | var tHead = {} 104 | for(i=1;#tab["fields"];1) table.push(tHead,{key = tab["fields"][i];name = tab["fields"][i];len = 80}); 105 | this.lvex.addHead(tHead) 106 | } 107 | this.lvex.showData(tab, currentPage, pageSize) 108 | }else { 109 | this.pagectrl.totalCount = "0"; 110 | } 111 | } 112 | 113 | loadSort = function(){//如果有本地列名排序表,重新排序列名 114 | var tabSortAll = {}; 115 | var code = string.load(this.sortFilePath); 116 | if(code){ 117 | tabSortAll = eval(code); 118 | } 119 | var tabSort = tabSortAll[[this.ResName]] : {}; 120 | var tablist,tab = {},{}; 121 | var tabFiles = table.clone(this.table); 122 | for(i,t in tabFiles ){ 123 | if(t.key == "rowId"){ 124 | table.push(tablist,t) 125 | }else { 126 | table.push(tab,t) 127 | } 128 | } 129 | for(i=1;#tabSort;1){ 130 | var row = tabSort[i]; 131 | if(type.table != type(row)) break ; 132 | var name = row["n"]; 133 | for(k,t in tab){ 134 | if(t.name == name){ 135 | t["s"] = row["s"]; 136 | t.len = t["s"] ? t.len : 0; 137 | table.push(tablist,t) 138 | break ; 139 | } 140 | } 141 | } 142 | for(k,t in tab){ 143 | var bool = false; 144 | for(i=1;#tabSort;1){ 145 | var row = tabSort[i]; 146 | if(type.table != type(row)) break ; 147 | if(row.n == t.name) bool = true; 148 | } 149 | if(!bool) table.push(tablist,t) 150 | } 151 | return tablist,tabSortAll; 152 | } 153 | 154 | loadHead = function(resName){ 155 | this.ResName = (this.ResName : resName : this.parent.ResName : "name"); 156 | var tab = this.loadSort();//重新排序列名 157 | if(#tab) this.lvex.addHead(tab);//加载列名 158 | } 159 | 160 | load = function(resName){ 161 | this.loadHead(resName) 162 | this.search();//显示首页 163 | } 164 | 165 | search = function(){ 166 | this.pagectrl.load();//显示首页 167 | ..win.delay(100); 168 | } 169 | 170 | start = function(msg = true, checked = true, selected = true){ 171 | this.parent.index = null; 172 | this.parent.tindex = null; 173 | this.index = null; 174 | this.tindex = null; 175 | var index,t = this.lvex.getCheckedorSelected(checked,selected) 176 | if( !index && msg){ 177 | this.msgbox("请先打勾行或者选中行","提示") 178 | return false; 179 | } 180 | //this.parent.index = index; 181 | //this.parent.tindex = t; 182 | this.index = index; 183 | this.tindex = t; 184 | return true; 185 | } 186 | 187 | export = function(filename,sheetname,action){ 188 | if(not this.start()){return false; } 189 | var tdao = {} 190 | for(k,t in this.table) if(t.len > 0) table.push(tdao,t.key); 191 | var tnow = ..time(); 192 | tnow.format = "%Y%m%d-%H%M%S"; 193 | filename := tostring(tnow) 194 | var ok,err; 195 | if(action == "com"){ 196 | ok,err = this.lvex.exportToExcelCom(tdao, filename,sheetname);//文件名称 197 | } 198 | else{ 199 | ok,err = this.lvex.exportToExcel(tdao, filename,sheetname);//文件名称 200 | } 201 | if(ok){ 202 | if(this.msgboxTest("导出成功。是否打开?","提示")){ 203 | ..process.execute(ok); 204 | } 205 | }elseif(err) { 206 | this.msgbox("导出失败," + err,"提示") 207 | } 208 | } 209 | 210 | exportToExcel = function(filename,sheetname){ 211 | this.export(filename,sheetname); 212 | } 213 | 214 | exportToExcelCom = function(filename,sheetname){ 215 | this.export(filename,sheetname,"com"); 216 | } 217 | 218 | exportToExecl = function(filename,sheetname){//弃用 219 | this.exportToExcel(filename,sheetname); 220 | } 221 | 222 | refresh = function(){ 223 | this.pagectrl.showFunc() 224 | } 225 | 226 | } 227 | 228 | namespace page { 229 | string = ..string; 230 | table = ..table; 231 | math = ..math; 232 | 233 | hwndmouse = ..win.cur.load(32649/*_IDC_HAND*/)//鼠标形状变成手状句柄 234 | 235 | _metaProperty = ..util.metaProperty( 236 | 237 | setPageSize = { 238 | _set = function( v ){ 239 | owner.pagectrl.pageSize = v; 240 | } 241 | }; 242 | 243 | getPageSize = { 244 | _get = function(){ 245 | return owner.pagectrl.pageSize; 246 | } 247 | }; 248 | 249 | setBottomText = { 250 | _set = function( v ){ 251 | owner.txtMsg.text = v; 252 | } 253 | }; 254 | ) 255 | } 256 | 257 | /*intellisense() 258 | !page.setPageSize = @.setPageSize = 50;//设置每页显示记录数,值可忽略,默认50 259 | !page.getPageSize = 获取每页显示记录数 260 | !page.load() = 加载列名并搜索第一页 261 | !page.loadHead() = 加载列名 262 | !page.search() = 搜索第一页 263 | !page.webService = 设置数据库访问层的类库,如 ws.System 264 | !page.sql = 设置主SQL语句 265 | !page.orderby = 设置SQL排序,如 id,name desc 266 | !page.where() = @.where = function(){\n var where = "1=1 ";\n __\n return where; \n}//自定义函数返回SQL中where部分,不包括where本身 267 | !page.table = @.table = {\n {key = "rowId";name = "序号";len = 50};\n __\n {key = "Id";name = "主键ID";len = 0};\n}//设置列名表table对像 268 | !page.start() = 初始化操作,返回是否打勾或选中行,同时把选中附值于,winform.page.index和winform.page.tindex 269 | !page.index = 选中的行 270 | !page.tindex = 选中的行集合 271 | !page.selected() = @.selected = function(){\n __\n}//点全选或反选后,回调函数 272 | !page.getTable() = @.getTable = function(){\n var tab,err = {};\n __\n return tab,err; \n}//定义SQL返回数据集,回调函数,同时webService,sql,orderby,where四个函数将失效 273 | !page.isPage = @.isPage = true;//是否分页 274 | !page.drive = @.drive = "mysql";//数据库类型,mysql或mssql,默认mysql 275 | !page.lastSql = 最后一次执行的SQL语句 276 | !page.setBottomText = @.setBottomText = "";//设置页面底部信息 277 | !page.exportToExcel() = 导出到Execl,参数:文件名,工作溥,可忽略 (使用access) 278 | !page.exportToExcelCom() = 导出到Execl,参数:文件名,工作溥,可忽略(使用com.excel) 279 | !page.refresh() = 刷新当前页 280 | !page.listview() = 返回原始listview控件对像\n!listview. 281 | !page.listviewEx() = 返回listviewex扩展控件对像\n!lvEx. 282 | ?win.ui.ctrl.page = !page. 283 | win.ui.ctrl.page() = 整页控件\n!page. 284 | end intellisense*/ 285 | -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/pageSort.aardio: -------------------------------------------------------------------------------- 1 | //pageSort 列名排序 2 | import win.ui; 3 | import carl.ctrl; 4 | import fsys; 5 | /*DSG{{*/ 6 | var winform = win.form(text="自定义设置列名";right=305;bottom=325;border="dialog frame";exmode="toolwindow";max=false;min=false) 7 | winform.add( 8 | lvex={cls="listviewex";text="listview扩展控件";left=1;top=26;right=305;bottom=325;db=1;dl=1;dr=1;dt=1;edge=1;transparent=1;z=2}; 9 | toolbar={cls="toolbar";text="工具条";left=0;top=-2;right=308;bottom=25;center=1;dl=1;dr=1;dt=1;edge=1;transparent=1;z=1} 10 | ) 11 | /*}}*/ 12 | 13 | var sortCommand,showList,tabSort,tabSortAll,save;; 14 | var form = ...; 15 | fsys.createDir("/config/") 16 | winform.lvex.isSort = false; 17 | winform.listview = winform.lvex.getListview(); 18 | 19 | var tabhead = { 20 | {key = "Show";name = "是否显示";len = 60}; 21 | {key = "ListName";name = "列名称";len = 150}; 22 | {key = "rowId";name = "排序号";len = 50}; 23 | } 24 | 25 | showList = function(tab){ 26 | winform.lvex.clearRow(); 27 | for(i,t in tab){ 28 | if((t.len || (t.len<=0 && t.s !== null)) && t.key != "rowId"){ 29 | var index = winform.lvex.addItem(""); 30 | winform.lvex.set("ListName",index,t.name) 31 | winform.lvex.set("rowId",index,index) 32 | if(t.s !== false) winform.listview.setChecked(index); 33 | } 34 | } 35 | } 36 | 37 | sortCommand = function(str){ 38 | var text1,text2,index2,check1,check2; 39 | for(index1=1;winform.listview.count;1){ 40 | if( winform.listview.getSelected(index1) ){ 41 | text1 = winform.lvex.get(index1,"ListName"); 42 | if(str == 1){//上移 43 | index2 = index1-1; 44 | }else { 45 | index2 = index1+1; 46 | } 47 | if(index2 < 1 || index2 > winform.listview.count) break ; 48 | text2 = winform.lvex.get(index2,"ListName"); 49 | check1 = winform.listview.getChecked(index1); 50 | check2 = winform.listview.getChecked(index2); 51 | winform.lvex.set("ListName",index2,text1); 52 | winform.lvex.set("ListName",index1,text2); 53 | winform.listview.setChecked(index2,check1); 54 | winform.listview.setChecked(index1,check2); 55 | winform.listview.setSelected(index2); 56 | winform.listview.setSelected(index1,false); 57 | winform.listview.selIndex = index2; 58 | winform.listview.ensureVisible(); 59 | break ; 60 | } 61 | } 62 | } 63 | 64 | save = function(tab){ 65 | tabSortAll[form.ResName] = tab; 66 | string.save(form.sortFilePath, table.tostring(tabSortAll)) 67 | form.lvex.clearAll(); 68 | form.load() 69 | } 70 | 71 | winform.btnUp = function(){ 72 | sortCommand(1); 73 | } 74 | 75 | winform.btnDown = function(){ 76 | sortCommand(2); 77 | } 78 | 79 | winform.btnDefault = function(){ 80 | showList(form.table); 81 | save(); 82 | } 83 | 84 | winform.btnSave = function(){ 85 | tabSort = {} 86 | for(index=1;winform.listview.count;1){ 87 | var s = winform.listview.getChecked(index); 88 | var n = winform.lvex.get(index,"ListName"); 89 | table.push(tabSort,{s=s;n=n}); 90 | } 91 | save(tabSort) 92 | } 93 | 94 | winform.load = function(){ 95 | winform.lvex.addHead(tabhead);//加载列名 96 | tabSort,tabSortAll = form.loadSort();//加载本地列名排序表 97 | showList(tabSort); 98 | } 99 | 100 | winform.toolbar.btnSave(winform.btnSave,"保存") 101 | winform.toolbar.btnUp(winform.btnUp, "上移") 102 | winform.toolbar.btnDown(winform.btnDown, "下移") 103 | winform.toolbar.btnRefresh(winform.btnDefault, "默认设置") 104 | winform.show() 105 | winform.load(); 106 | win.loopMessage(); 107 | return winform; 108 | -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/pagectrl.aardio: -------------------------------------------------------------------------------- 1 | //pagectrl 分页控件 2 | namespace carl.ctrl.pagectrl{} 3 | 4 | import util.metaProperty; 5 | namespace win.ui.ctrl; 6 | class pagectrl { 7 | ctor(parent,tParam){ 8 | /*DSG{{*/ 9 | this = win.form(text="aardio form";right=706;bottom=22;border="none";exmode="none";mode="child";parent=parent;tParam=tParam) 10 | this.add( 11 | btnPageEnd={cls="static";text="尾页";left=583;top=6;right=613;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=13}; 12 | btnPageNext={cls="static";text="下一页";left=534;top=6;right=573;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=14}; 13 | btnPagePrev={cls="static";text="上一页";left=484;top=6;right=524;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=11}; 14 | btnPageStart={cls="static";text="首页";left=447;top=6;right=474;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=10}; 15 | btnRefresh={cls="static";text="刷新";left=410;top=6;right=437;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=18}; 16 | btnReverse={cls="static";text="反选";left=46;top=6;right=75;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=17}; 17 | btnSearch={cls="static";text="跳转";left=677;top=6;right=705;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=12}; 18 | btnSelect={cls="static";text="全选";left=8;top=6;right=37;bottom=21;color=16711680;dl=1;dt=1;notify=1;transparent=1;z=16}; 19 | static={cls="static";text="/";left=114;top=6;right=129;bottom=21;dl=1;dt=1;transparent=1;z=1}; 20 | static2={cls="static";text="共";left=172;top=6;right=191;bottom=21;dl=1;dt=1;transparent=1;z=4}; 21 | static3={cls="static";text="条记录";left=262;top=6;right=305;bottom=21;dl=1;dt=1;transparent=1;z=6}; 22 | static4={cls="static";text="每页";left=307;top=6;right=335;bottom=21;dl=1;dt=1;transparent=1;z=7}; 23 | static5={cls="static";text="条";left=389;top=6;right=407;bottom=21;dl=1;dt=1;transparent=1;z=9}; 24 | txtNowPage={cls="static";text="1";left=75;top=6;right=109;bottom=21;align="right";color=255;dl=1;dt=1;transparent=1;z=2}; 25 | txtPageNum={cls="edit";text="1";left=622;top=2;right=669;bottom=22;autohscroll=false;autovscroll=false;dl=1;dt=1;edge=1;hidesel=1;num=1;z=15}; 26 | txtPageSize={cls="edit";text="50";left=335;top=2;right=382;bottom=22;autohscroll=false;autovscroll=false;dl=1;dt=1;edge=1;hidesel=1;num=1;z=8}; 27 | txtTotalCount={cls="static";text="1000000";left=193;top=6;right=253;bottom=19;align="center";color=255;dl=1;dt=1;transparent=1;z=5}; 28 | txtTotalPage={cls="static";text="1";left=126;top=6;right=166;bottom=21;color=255;dl=1;dt=1;transparent=1;z=3} 29 | ) 30 | /*}}*/ 31 | 32 | ..table.mix(this@, _metaProperty); 33 | } 34 | 35 | onCreate = function(){//创建窗口后触发此函数 36 | for(name,ctrl in this.eachControl() ){ 37 | if( ..string.startWith(name,"btn") ){ 38 | ctrl.wndproc = function(hwnd,message,wParam,lParam){ 39 | if(message = 0x200/*_WM_MOUSEMOVE*/ or message = 0x202/*_WM_LBUTTONUP*/) 40 | win.cur.setCur(hwndmouse);//鼠标形状变成手状 41 | } 42 | ctrl.oncommand = function(id,event){ 43 | if( event ) return ; 44 | ctrl.disabled = true; 45 | this.btnCommand( name ) 46 | ctrl.disabled = false; 47 | } 48 | } 49 | } 50 | } 51 | 52 | btnCommand = function( name ){ 53 | var nowpage = tonumber(this.txtNowPage.text); 54 | var totalpage = tonumber(this.txtTotalPage.text); 55 | var page = this.txtPageNum.text; 56 | select(name) { 57 | case "btnSelect" {//全选 58 | if( !this.listview ){ 59 | this.msgboxErr("请先绑定listview控件","错误"); 60 | return ; 61 | } 62 | for(i=1;this.listview.count;1) this.listview.setChecked(i); 63 | if(this.selected) this.selected(); 64 | } 65 | case "btnReverse" {//反选 66 | if( !this.listview ) return; 67 | for(i=1;this.listview.count;1) this.listview.setChecked(i,!this.listview.getChecked(i)) 68 | if(this.selected) this.selected(); 69 | } 70 | case "btnRefresh" {//刷新 71 | this.showFunc(); 72 | } 73 | case "btnPageStart" {//首页 74 | this.txtNowPage.text = 1; 75 | this.showFunc(); 76 | } 77 | case "btnPagePrev" {//上一页 78 | if( nowpage > 1 ){ 79 | this.txtNowPage.text = nowpage - 1; 80 | this.showFunc(); 81 | } 82 | } 83 | case "btnPageNext" {//下一页 84 | if( nowpage < totalpage ){ 85 | this.txtNowPage.text = nowpage + 1; 86 | this.showFunc(); 87 | } 88 | } 89 | case "btnPageEnd" {//尾页 90 | this.txtNowPage.text = totalpage; 91 | this.showFunc(); 92 | } 93 | case "btnSearch" {//跳转 94 | if( #page ){ 95 | this.txtNowPage.text = page; 96 | this.showFunc(); 97 | } 98 | } 99 | } 100 | } 101 | 102 | listview = function(listview){ 103 | this.listview = listview; 104 | } 105 | 106 | showFunc = function(){ 107 | if( !this["showPage"] ){ 108 | this.msgboxErr("请选绑定showPage显示函数","错误") 109 | return ; 110 | } 111 | this.showPage(); 112 | var page = tonumber(this.txtPageSize.text) : 30; 113 | this.txtPageSize.text = page; 114 | var totalCount = tonumber(this.txtTotalCount.text) : 0; 115 | this.txtTotalPage.text = ..math.ceil( totalCount/page );//总页数 116 | } 117 | 118 | load = function(){ 119 | this.btnPageStart.oncommand() 120 | } 121 | } 122 | 123 | namespace pagectrl { 124 | import win.cur; 125 | hwndmouse = win.cur.load(32649/*_IDC_HAND*/)//鼠标形状变成手状句柄 126 | 127 | _metaProperty = ..util.metaProperty( 128 | 129 | pageSize = {//每页记录数 130 | _get = function(){ 131 | return owner.txtPageSize.text; 132 | } 133 | _set = function( v ){ 134 | owner.txtPageSize.text = v; 135 | } 136 | }; 137 | 138 | nowPage = {//当前页数 139 | _get = function(){ 140 | return owner.txtNowPage.text; 141 | } 142 | _set = function( v ){ 143 | owner.txtNowPage.text = v; 144 | } 145 | }; 146 | 147 | totalCount = {//总记录 148 | _get = function(){ 149 | return owner.txtTotalCount.text; 150 | } 151 | _set = function( v ){ 152 | owner.txtTotalCount.text = v; 153 | } 154 | }; 155 | ) 156 | } 157 | 158 | /*intellisense() 159 | win.ui.ctrl.pagectrl = 分页控件 160 | win.ui.ctrl.pagectrl() = 分页控件 161 | ?win.ui.ctrl.pagectrl = !pagectrl. 162 | !pagectrl.pageSize = 获取或设置 每页显示记录数 163 | !pagectrl.nowPage = 获取或设置 当前页数 164 | !pagectrl.totalCount = 获取或设置 总记录 165 | !pagectrl.load() = 加载第一页 166 | !pagectrl.selected() = @.selected = function(){\n __\n}//点全选或反选后,回调函数 167 | !pagectrl.listview(.(listview控件) = 绑定listview控件 168 | end intellisense*/ 169 | -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/select.aardio: -------------------------------------------------------------------------------- 1 | //select 下拉框 2 | namespace carl.ctrl.select{} 3 | 4 | import util.metaProperty; 5 | import win.ui.ctrl; 6 | 7 | win.ui.ctrl.select = class { 8 | ctor(parent,tParam){ 9 | this = ..win.form(right=100;bottom=25;border="none";exmode="none";mode="child";parent=parent;tParam=tParam) 10 | this.add( 11 | combobox={cls="combobox";left=0;top=0;right=101;bottom=25;ah=1;aw=1;db=1;dl=1;dr=1;dt=1;edge=1;hscroll=1;items={};mode="dropdownlist";vscroll=1;z=1} 12 | ) 13 | 14 | this.valueId = "value"; 15 | this.textId = "text"; 16 | this.list = {}; 17 | ..table.mixin(this@, _metaProperty); 18 | }; 19 | 20 | onCreate = function(){ 21 | this.combobox.oncommand = function(id,event){ 22 | if(event == 0x9/*_CBN_SELENDOK*/){ 23 | if(this.selectChangeOk) this.selectChangeOk(id,event); 24 | } 25 | } 26 | this.clear(); 27 | }; 28 | 29 | add = function(k,v,row){ 30 | if(!k || !v) return ; 31 | this.combobox.add(tostring(v)); 32 | ..table.push(this.tabValue,k); 33 | ..table.push(this.tabText,v); 34 | var t = {}; 35 | if(type(row) == type.table) ..table.mixin(t,row); 36 | t[this.valueId] = k; 37 | t[this.textId] = v; 38 | ..table.push(this.list,t); 39 | } 40 | 41 | findValue = function(v){ 42 | if(!v) return ; 43 | return ..table.find(this.tabValue,v); 44 | } 45 | 46 | findText = function(v){ 47 | if(!v) return ; 48 | return ..table.find(this.tabText,v); 49 | } 50 | 51 | find = function(v){ 52 | return this.findValue(v) : this.findText(v); 53 | } 54 | 55 | clear = function(){ 56 | this.tabValue = {}; 57 | this.tabText = {}; 58 | this.list = {}; 59 | this.combobox.clear(); 60 | } 61 | } 62 | 63 | namespace win.ui.ctrl.select{ 64 | 65 | _metaProperty = ..util.metaProperty( 66 | 67 | items = { 68 | _get = function(){ 69 | return owner.list; 70 | } 71 | _set = function( t ){ 72 | for(i=1;#t;1){ 73 | var row = t[i]; 74 | if(type(row) != type.table) error("参数无效",2) 75 | var k = row[[owner.valueId]] : row[1]; 76 | var v = row[[owner.textId]] : row[2]; 77 | owner.add(k,v,row); 78 | } 79 | owner.selIndex = 1; 80 | } 81 | }; 82 | 83 | selIndex = { 84 | _get = function(){ 85 | return owner.combobox.selIndex; 86 | } 87 | _set = function( v ){ 88 | if(v){ 89 | owner.combobox.selIndex = v; 90 | if(owner.change && owner.selectChangeOk) owner.selectChangeOk(); 91 | } 92 | } 93 | }; 94 | 95 | setValue = { 96 | _set = function( v ){ 97 | owner.selIndex = ..table.find(owner.tabValue,v); 98 | } 99 | }; 100 | 101 | getValue = { 102 | _get = function(){ 103 | return owner.tabValue[[owner.combobox.selIndex]]; 104 | } 105 | }; 106 | 107 | setText = { 108 | _set = function( v ){ 109 | owner.selIndex = ..table.find(owner.tabText,v); 110 | } 111 | }; 112 | 113 | getText = { 114 | _get = function(){ 115 | return owner.tabText[[owner.combobox.selIndex]]; 116 | } 117 | }; 118 | 119 | getItemData = { 120 | _get = function(){ 121 | return owner.list[[owner.combobox.selIndex]]; 122 | } 123 | }; 124 | ) 125 | } 126 | 127 | /*intellisense() 128 | win.ui.ctrl.select = select下拉选项控件 129 | win.ui.ctrl.select() = select下拉选项控件 130 | ?win.ui.ctrl.select = !select. 131 | !select.items = 获取或设置table对像数据源(设置时是追加模式);格式如:\n{\n {value="值1";text="内容1"};\n {value="值2";text="内容2"}\n} 132 | !select.setValue = 设置value值 133 | !select.getValue = 获取value值 134 | !select.setText = 设置显示text值 135 | !select.getText = 获取显示text值 136 | !select.valueId = @.valueId = "value";//绑定数据源value值字段 137 | !select.textId = @.textId = "text";//绑定数据源text值字段 138 | !select.selIndex = 获取或设置选中的选项序ID, 139 | !select.add(value,text) = 添加内容到选项,参数一:value值,参数二:text显示内容 140 | !select.find() = 精确查找内容,先找value值,如果没有再找text值,返回选项序ID 141 | !select.findValue() = 精确查找value值,是否存在,返回选项序ID 142 | !select.findText() = 精确查找显示内容text值,是否存在,返回选项序ID 143 | !select.selectChangeOk = @.selectChangeOk = function(){\n __\n}//下拉框值改变后回调函数 144 | !select.change = @.change = true;//设置true后,对这四个属性items,setValue,setText,selIndex附值后,将会自动触发selectChangeOk()函数 145 | !select.clear() = 清空所有项 146 | !select.getItemData = 获取选中项数据集table对像 147 | !select.combobox = 原生win.ui.ctrl.combobox控件对像 148 | !select.combobox = !combobox. 149 | end intellisense*/ 150 | -------------------------------------------------------------------------------- /carlmvc/lib/carl/ctrl/tab.aardio: -------------------------------------------------------------------------------- 1 | //tab 选项卡扩展 2 | 3 | import win.ui.menu; 4 | namespace carl.ctrl 5 | 6 | tab = class { 7 | ctor( tabctrl ){ 8 | var mainForm = ..win.form.getForm(tabctrl.hwnd) 9 | var x,y; 10 | var menuTab = ..win.ui.popmenu(mainForm);//选项卡右键菜单 11 | menuTab.add( 12 | '关闭当前标签页', 13 | function(id){ 14 | this.closeTabForm() 15 | } 16 | ) 17 | menuTab.add( 18 | '关闭其他标签页', 19 | function(id){ 20 | this.closeTabForm(,"other") 21 | } 22 | ) 23 | menuTab.add() 24 | menuTab.add( 25 | '关闭右侧标签页', 26 | function(id){ 27 | this.closeTabForm(,"right") 28 | } 29 | ) 30 | menuTab.add( 31 | '关闭左侧标签页', 32 | function(id){ 33 | this.closeTabForm(,"left") 34 | } 35 | ) 36 | menuTab.add() 37 | menuTab.add( 38 | '关闭全部标签页', 39 | function(id){ 40 | this.closeTabForm(,"all") 41 | } 42 | ) 43 | this = tabctrl; 44 | this.tabForm = {}; 45 | this.isOpenOnlyOne = true;//一个页面只能打开一次 46 | }; 47 | 48 | exWndproc = function(hwnd,message,wParam,lParam){ 49 | if ( message == 0x207/*_WM_MBUTTONDOWN*/ or message = 0x203/*_WM_LBUTTONDBLCLK*/) { //鼠标中键点击选项卡或双击,关闭窗口 50 | x,y = ::LOWORD(lParam), ::HIWORD(lParam); 51 | this.closeTabForm(); 52 | } 53 | else if (message = 0x204/*_WM_RBUTTONDOWN*/){ //鼠标右键点击选项卡,弹出菜单 54 | x,y = ::LOWORD(lParam), ::HIWORD(lParam); 55 | var rc = ::RECT(); 56 | rc.left,rc.top = x,y; 57 | ::ClientToScreen(this.hwnd,rc); 58 | menuTab.popup(rc.left,rc.top,true);//弹出菜单 59 | } 60 | } 61 | 62 | addTabForm = function( file, title, menuId, ...){ 63 | if(!#file) return ; 64 | this.hide = false; 65 | if(this.isOpenOnlyOne){ 66 | var index = table.find(this.tabForm,file); 67 | if( index ){ 68 | this.selIndex = index; 69 | return ; 70 | } 71 | } 72 | var form,wb = this.loadForm(file); 73 | if(!form) return null,wb; 74 | form.ResName = menuId : file;//列顺序用 75 | var sel = #this.items; 76 | this.selIndex = sel; 77 | if( title ) this.setItemText(sel,title); 78 | table.push(this.tabForm,file) 79 | if( form[["loadButton"]] ) form.loadButton(menuId);//页面按钮权限 80 | if( form[["load"]] ) form.load(...);//打开时加载 81 | 82 | for(name,ctrl in form.eachControl() ){ 83 | if(string.find(ctrl.cls:"","|