example8.e 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. class EXAMPLE8
  2. -- This example show how use a cbox, a gridbox and a zbox.
  3. inherit
  4. IUP_INTERFACE
  5. create {ANY}
  6. make
  7. feature {ANY}
  8. make
  9. local
  10. gui: IUP
  11. v: IUP_VBOX
  12. b1, b2, b3, b4, b5, b6, b7, b8, b9, b10: IUP_BUTTON
  13. cb: IUP_CBOX
  14. gb: IUP_GRID_BOX
  15. zb: IUP_ZBOX
  16. norm: IUP_NORMALIZER
  17. w: IUP_DIALOG
  18. i: STRING
  19. do
  20. gui := iup_open
  21. create b1.button("Button 1")
  22. b1.set_cx(10)
  23. b1.set_cy(10)
  24. create b2.button("Button 2")
  25. b2.set_cx(50)
  26. b2.set_cy(45)
  27. create b3.button("Button 3")
  28. create b4.button("Another Button ")
  29. create b5.button("Button Five")
  30. create b6.button("Button 6")
  31. create b7.button("Button Seven")
  32. create b8.button("Button 8")
  33. create b9.button("Button 9")
  34. create b10.button("Button 10")
  35. -- Normalizer
  36. create norm.normalizer({ARRAY[IUP_WIDGET]} << b3, b4, b5, b6, b7, b8 >>)
  37. -- The cbox
  38. create cb.cbox({ARRAY[IUP_WIDGET]} << b1, b2 >>)
  39. -- The gridbox
  40. create gb.grid_box({ARRAY[IUP_WIDGET]} << b3, b4, b5, b6, b7, b8 >>)
  41. gb.set_numdiv(2) -- Display two elements per row
  42. -- The zbox
  43. create zb.zbox({ARRAY[IUP_WIDGET]} << b9, b10 >>)
  44. zb.set_value_widget(b10) -- Make the b10 visible, this hide b9
  45. -- Put all into a vertical box.
  46. create v.vbox({ARRAY[IUP_WIDGET]} << norm, cb, gb, zb >>)
  47. v.set_alignment("ACENTER")
  48. v.set_gap(10)
  49. v.set_margin(10, 10)
  50. -- Create the window.
  51. create w.dialog(v)
  52. w.set_title("Example 8")
  53. i := w.show
  54. -- If you don't add the normalizer to the dialog, then you
  55. -- can call "normalize_size_XXX" after the dialog is show.
  56. -- norm.normalize_size_horizontal
  57. gui.main_loop
  58. gui.close
  59. end
  60. end