example2.e 855 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. class EXAMPLE2
  2. inherit
  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. lk: IUP_LINK
  14. b: IUP_BUTTON
  15. h: IUP_HBOX
  16. w: IUP_DIALOG
  17. do
  18. gui := iup_open
  19. create l.label("Hello world from Eiffel-IUP!")
  20. create lk.link("https://notabug.org/GermanGT/eiffel-iup", "Visit the website")
  21. create b.button("OK")
  22. b.set_cb_action(agent close)
  23. b.set_maxsize(70, 30)
  24. a := {ARRAY[IUP_WIDGET]} << l, lk, b >>
  25. create h.hbox(a)
  26. h.set_alignment("ACENTER")
  27. h.set_gap(10)
  28. h.set_margin(10, 10)
  29. create w.dialog(h)
  30. w.set_title("Hello world")
  31. i := w.show
  32. gui.main_loop
  33. gui.close
  34. end
  35. close (widget: IUP_BUTTON): STRING
  36. do
  37. Result := "IUP_CLOSE"
  38. end
  39. end -- class EXAMPLE2