test-fltk-list-search.nut 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. function _tr(str){ return str;}
  2. class Fl_Data_Table extends Flv_Table {
  3. _forPrint = null;
  4. constructor(px, py, pw, ph, pl=""){
  5. base.constructor(px, py, pw, ph, pl);
  6. _forPrint=false;
  7. }
  8. }
  9. class Fl_Box_ClearLabel extends Fl_Box {
  10. constructor(px, py, pw, ph, pl=""){
  11. base.constructor(px, py, pw, ph, pl);
  12. }
  13. }
  14. class Flu_Combo_List extends Fl_Box {
  15. constructor(px, py, pw, ph, pl=""){
  16. base.constructor(px, py, pw, ph, pl);
  17. }
  18. }
  19. class Fl_Image_Box extends Fl_Box {
  20. constructor(px, py, pw, ph, pl=""){
  21. base.constructor(px, py, pw, ph, pl);
  22. }
  23. }
  24. class Fl_Choice_Int extends Fl_Button {
  25. constructor(px, py, pw, ph, pl=""){
  26. base.constructor(px, py, pw, ph, pl);
  27. }
  28. }
  29. class Fl_Float_Input_Fmt extends Fl_Float_Input {
  30. constructor(px, py, pw, ph, pl=""){
  31. base.constructor(px, py, pw, ph, pl);
  32. }
  33. }
  34. class My_Fl_Float_Input extends Fl_Float_Input {
  35. constructor(px, py, pw, ph, pl=""){
  36. base.constructor(px, py, pw, ph, pl);
  37. }
  38. }
  39. class My_Fl_Return_Button extends Fl_Button {
  40. constructor(px, py, pw, ph, pl=""){
  41. base.constructor(px, py, pw, ph, pl);
  42. }
  43. }
  44. class Fl_Choice_Str extends Fl_Button {
  45. constructor(px, py, pw, ph, pl=""){
  46. base.constructor(px, py, pw, ph, pl);
  47. }
  48. }
  49. class Flu_Combo_Box extends Fl_Button {
  50. constructor(px, py, pw, ph, pl=""){
  51. base.constructor(px, py, pw, ph, pl);
  52. }
  53. }
  54. function add_input_field_to_map(tbl, fldname, fld){
  55. }
  56. class ListSearchWindow extends Fl_Window {
  57. // Declaration of class members
  58. topGroup = null;
  59. group_filter = null;
  60. query_limit = null;
  61. btnNotes = null;
  62. middleGroup = null;
  63. grid = null;
  64. bottomGroup = null;
  65. pack_search_options = null;
  66. search_str = null;
  67. btnSearch = null;
  68. btnSelect = null;
  69. btnUpdate = null;
  70. btnInsert = null;
  71. btnThumbImage = null;
  72. pack_search_options2 = null;
  73. constructor(){
  74. base.constructor(132, 118, 800, 560);
  75. // Create member functions and widgets
  76. {
  77. local o = Fl_Group(0, 0, 800, 35);
  78. topGroup = o;
  79. o.labelsize(16);
  80. {
  81. {
  82. local o = Flu_Combo_Tree(5, 5, 675, 25);
  83. group_filter = o;
  84. o.textsize(16);
  85. o.labeltype(FL_NO_LABEL);
  86. o.labelsize(16);
  87. }
  88. {
  89. local o = Fl_Int_Input(690, 6, 60, 25);
  90. query_limit = o;
  91. o.textsize(16);
  92. o.labeltype(FL_NO_LABEL);
  93. o.labelsize(16);
  94. o->value("50");
  95. }
  96. {
  97. local o = Fl_Button(760, 6, 35, 25, _tr ("?"));
  98. btnNotes = o;
  99. o.labelsize(16);
  100. }
  101. }
  102. o.end();
  103. }
  104. {
  105. local o = Fl_Group(0, 41, 800, 409);
  106. middleGroup = o;
  107. o.labelsize(16);
  108. {
  109. {
  110. local o = Fl_Data_Table(5, 41, 790, 389);
  111. grid = o;
  112. o.textsize(16);
  113. o.labeltype(FL_NO_LABEL);
  114. o.labelsize(16);
  115. o.end();
  116. Fl_Group.current().resizable(o);
  117. }
  118. }
  119. o.end();
  120. Fl_Group.current().resizable(o);
  121. }
  122. {
  123. local o = Fl_Group(4, 440, 790, 115);
  124. bottomGroup = o;
  125. o.box(FL_ENGRAVED_BOX);
  126. o.labelsize(16);
  127. o.color(246);
  128. {
  129. {
  130. local o = Fl_Pack(14, 450, 320, 25);
  131. pack_search_options = o;
  132. o.type(1);
  133. o.labelsize(16);
  134. o->spacing(10);
  135. o.end();
  136. }
  137. {
  138. local o = Fl_Input(35, 485, 299, 25, _tr ("@search"));
  139. search_str = o;
  140. o.textsize(16);
  141. o.when(8);
  142. o.labelsize(16);
  143. o.callback(function(sender, udata){
  144. on_search();
  145. });
  146. }
  147. {
  148. local o = Fl_Button(345, 485, 100, 25, _tr ("Search"));
  149. btnSearch = o;
  150. o.labelsize(16);
  151. o.callback(function(sender, udata){
  152. on_search();
  153. });
  154. }
  155. {
  156. local o = Fl_Button(14, 520, 100, 25, _tr ("Select"));
  157. btnSelect = o;
  158. o.labelsize(16);
  159. o.callback(function(sender, udata){
  160. on_select();
  161. });
  162. }
  163. {
  164. local o = Fl_Button(124, 520, 100, 25, _tr ("Update"));
  165. btnUpdate = o;
  166. o.labelsize(16);
  167. o.callback(function(sender, udata){
  168. on_update();
  169. });
  170. }
  171. {
  172. local o = Fl_Button(234, 520, 100, 25, _tr ("Insert"));
  173. btnInsert = o;
  174. o.labelsize(16);
  175. o.callback(function(sender, udata){
  176. on_insert();
  177. });
  178. }
  179. {
  180. local o = Fl_Image_Box(663, 445, 125, 105);
  181. btnThumbImage = o;
  182. o.box(FL_NO_BOX);
  183. o.align(80);
  184. }
  185. {
  186. local o = Fl_Box(650, 445, 5, 105);
  187. o.align(80);
  188. o.labeltype(FL_NO_LABEL);
  189. o.labelsize(16);
  190. Fl_Group.current().resizable(o);
  191. }
  192. {
  193. local o = Fl_Pack(345, 520, 300, 25);
  194. pack_search_options2 = o;
  195. o.type(1);
  196. o.labelsize(16);
  197. o->spacing(10);
  198. o.end();
  199. }
  200. }
  201. o.end();
  202. }
  203. group_filter->textfont(group_filter->labelfont());
  204. group_filter->textsize(group_filter->labelsize());
  205. };
  206. }
  207. //local win = new MainWindow(10, 50, 330, 320, "OURBIZ");
  208. local win = new ListSearchWindow();
  209. win->resizable(win);
  210. win->show_main();
  211. local tree = win->group_filter->tree();
  212. tree->show_root(true);
  213. tree->auto_branches(true);
  214. tree->show_branches(true);
  215. tree->all_branches_always_open(true);
  216. local node = tree->get_root();
  217. print(node)
  218. local node2 = tree->add(node, "DAD");
  219. print(node2)
  220. local node3 = tree->add(node2, "TAIS");
  221. print(node3)
  222. local node22 = tree->add(node, "LIINUX");
  223. print(node22)
  224. math.number_format_set_dec_point(",");
  225. math.number_format_set_thousand_sep(".");
  226. Fl_Input.default_number_format("\0x02,.");
  227. //Fl:scheme("plastic");
  228. Fl.scheme("gtk+");
  229. //use partial match to find verdana font
  230. Fl.visual(FL_RGB);
  231. //allow arrow keys navigation
  232. Fl.option(Fl.OPTION_ARROW_FOCUS, true);
  233. Fl.run();