/tutorial/vision/layout/align.e

http://github.com/tybor/Liberty · Specman e · 41 lines · 28 code · 10 blank · 3 comment · 0 complexity · d5f972e78f91af80b8bd976d9de1a29f MD5 · raw file

  1. class ALIGN
  2. --
  3. -- This example show how to use ALIGNABLE_LABEL.
  4. --
  5. inherit
  6. GRAPHIC
  7. creation {ANY}
  8. make
  9. feature {}
  10. toplevel_window: TOPLEVEL_WINDOW
  11. make is
  12. local
  13. alignable_label: ALIGNABLE_LABEL; button: BUTTON
  14. do
  15. create toplevel_window
  16. toplevel_window.set_title("Align demo")
  17. toplevel_window.set_background_color(white_color)
  18. toplevel_window.map
  19. create alignable_label.make(U"Text on the left")
  20. alignable_label.set_alignment(left_alignment)
  21. toplevel_window.child_attach(alignable_label)
  22. create alignable_label.make(U"Text on the right")
  23. alignable_label.set_alignment(right_alignment)
  24. toplevel_window.child_attach(alignable_label)
  25. toplevel_window.child_attach(create {HORIZONTAL_LINE})
  26. create button.with_label(toplevel_window, U"Exit")
  27. button.when_left_clicked(agent vision.loop_stack.break)
  28. vision.start
  29. io.put_string("The end%N")
  30. end
  31. end -- class ALIGN