input.km 866 B

123456789101112131415161718192021222324252627282930
  1. type Data {
  2. a: Bool,
  3. b: Maybe[Number],
  4. c: String,
  5. d: String
  6. };
  7. do Window.{show-at-center};
  8. do Window.{on-close}.{connect {os::exit 0}};
  9. do
  10. \ data := sync { Reactive { |Data| { a: No, b: None, c: '', d: 'Lorem Ipsum' } } },
  11. let (a,b,c,d) :=
  12. ((data proj |.(a)|),
  13. (data proj |.(b)|),
  14. (data proj |.(c)|),
  15. (data proj |.(d)|)),
  16. { merge [
  17. (InputCheckBox bind a),
  18. (InputComboBox bind b),
  19. (InputLineEdit bind c),
  20. (InputPlainTextEdit bind d),
  21. (ButtonClear.{activated}.{connect (c <- '')}),
  22. (ValueCheckBox bind a.{watch}.{map &(a) => if a: 'Yes', else: 'No'}),
  23. (ValueComboBox bind b.{watch}.{map &(b) => switch b: case Some b: b.{String}, case None: 'None', end}),
  24. (ValueLineEdit bind c.{watch}),
  25. (ValuePlainTextEdit bind d.{watch})
  26. ] };