Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. local counter=0;
  2. local printcounter = function ()
  3.   windowprint(10,54, string.format("% .3d", counter));
  4. end;
  5.  
  6. windowopen(100,150, "Dialogtest");
  7. windowbutton(6, 18, 54, 14, "Close", 27); -- 1, shortcut=ESC
  8. windowrepeatbutton(6, 38, 14, 14, "+");   -- 2
  9. windowrepeatbutton(26, 38, 14, 14, "-");  -- 3
  10. windowbutton(6, 70, 54, 14, "Help");      -- 4
  11. windowinput(6, 88, 10);
  12. printcounter();
  13.  
  14. repeat
  15.  local button, button2, key = windowdodialog();
  16.  
  17.   if button == 2 then -- "+"
  18.     counter=counter+1;
  19.     printcounter();
  20.   end
  21.   if button == 3 then -- "-"
  22.     counter=counter-1;
  23.     printcounter();
  24.   end
  25.   if button == 4 then -- "Help"
  26.     messagebox("Help screen");
  27.   end
  28. until key == 27 or button == 1;
  29. windowclose();
  30.  
  31.  
  32. -- messagebox(tostring(button) .. " " .. tostring(button2));
  33.  
  34.  
  35. ---- Open_window(149,118,"Grid");
  36. -- Display_cursor();
  37. -- Hide_cursor();
  38. ---- Close_window();
  39. ---- Update_window_area(0,0,Window_width, Window_height);
  40. ---- clicked_button=Window_clicked_button();
  41. --
  42. -- -- standard button
  43. ---- Window_set_normal_button(12,92,51,14,"Cancel",0,1,KEY_ESC);  -- 1
  44. -- -- repeatable button (while held)
  45. ---- Window_set_repeatable_button(202,43,13,11,"-",0,1,SDLK_LAST); -- 8
  46. -- -- text input
  47. -- Window_set_input_button(29,24,3); -- 3
  48. -- Window_input_content(input_x_button,str);
  49. -- Readline(31,26,str,3,INPUT_TYPE_INTEGER);
  50. --
  51. -- -- dropdown
  52. -- Window_set_dropdown_button(216, 158, 84,14,84,"Preset...", 0,0,1,RIGHT_SIDE|LEFT_SIDE,1);
  53. -- Window_dropdown_clear_items(Button);
  54. -- Window_dropdown_add_item(Button,0,"Set");
  55. --
  56. -- -- vertical scroller
  57. -- mix_scroller = Window_set_scroller_button(31,20,84,256,1,Main_backups->Pages->Gradients->Range[Current_gradient].Mix);
  58. -- Window_draw_slider(mix_scroller);
  59. --
  60. -- -- display
  61. ---- Print_in_window(11,26, "X:",MC_Dark,MC_Light);
  62. ---- Print_in_window_limited(Button->Pos_X+3+10,Button->Pos_Y+2,Config.Bookmark_label[bookmark_number],8,MC_Black,MC_Light);
  63. -- Window_display_frame_in( 6, 21,110, 52);
  64. -- Window_display_frame(6,17,130,37);
  65. -- Window_rectangle(panel->Pos_X, panel->Pos_Y, panel->Width, panel->Height+1, MC_Light);
  66.  
  67.