example1.e 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. class EXAMPLE1
  2. insert
  3. IUP_INTERFACE
  4. create {ANY}
  5. make
  6. feature {ANY}
  7. make
  8. local
  9. gui: IUP
  10. i: STRING
  11. a: ARRAY[IUP_WIDGET]
  12. l: IUP_LABEL
  13. b: IUP_BUTTON
  14. f: IUP_FLAT_BUTTON
  15. v: IUP_VBOX
  16. w: IUP_DIALOG
  17. do
  18. gui := iup_open
  19. create l.label("Hello world from Liberty Eiffel!")
  20. create b.button("OK")
  21. b.set_cb_action(agent close(?))
  22. b.set_rgb_background_color(0, 200, 0) -- This not work on Gtk3, use IUP_FLAT_BUTTON as show below.
  23. create f.flat_button("A flat button")
  24. f.set_cb_flat_action(agent close(?))
  25. f.set_rgb_background_color(0, 200, 0)
  26. f.set_padding(5, 3)
  27. f.set_border(True)
  28. a := {ARRAY[IUP_WIDGET] 1, << l, b, f >>}
  29. create v.vbox(a)
  30. v.set_alignment("ACENTER")
  31. v.set_gap(10)
  32. v.set_margin(10, 10)
  33. create w.dialog(v)
  34. w.set_title("Hello world")
  35. i := w.show
  36. gui.main_loop
  37. gui.close
  38. end
  39. close (widget: IUP_WIDGET): STRING
  40. do
  41. io.put_string("Executed %N")
  42. Result := "IUP_CLOSE"
  43. end
  44. end -- class EXAMPLE1