example8.e 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. class EXAMPLE8
  2. -- This example show how use a cbox, a gridbox and a zbox.
  3. insert
  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. w: IUP_DIALOG
  17. i: STRING
  18. do
  19. gui := iup_open
  20. create b1.button("Button 1")
  21. b1.set_cx(10)
  22. b1.set_cy(10)
  23. create b2.button("Button 2")
  24. b2.set_cx(50)
  25. b2.set_cy(45)
  26. create b3.button("Button 3")
  27. create b4.button("Button 4")
  28. create b5.button("Button 5")
  29. create b6.button("Button 6")
  30. create b7.button("Button 7")
  31. create b8.button("Button 8")
  32. create b9.button("Button 9")
  33. create b10.button("Button 10")
  34. -- The cbox
  35. create cb.cbox({ARRAY[IUP_WIDGET] 1, << b1, b2 >>})
  36. -- The gridbox
  37. create gb.grid_box({ARRAY[IUP_WIDGET] 1, << b3, b4, b5, b6, b7, b8 >>})
  38. gb.set_numdiv(2) -- Display two elements per row
  39. -- The zbox
  40. create zb.zbox({ARRAY[IUP_WIDGET] 1, << b9, b10 >>})
  41. zb.set_value_widget(b10) -- Make the b10 visible, this hide b9
  42. -- Put all into a vertical box.
  43. create v.vbox({ARRAY[IUP_WIDGET] 1, << cb, gb, zb >>})
  44. v.set_alignment("ACENTER")
  45. v.set_gap(10)
  46. v.set_margin(10, 10)
  47. -- Create the window.
  48. create w.dialog(v)
  49. w.set_title("Example 8")
  50. i := w.show
  51. gui.main_loop
  52. gui.close
  53. end
  54. end