Text.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Text;
  2. using Terminal.Gui;
  3. namespace UICatalog {
  4. [ScenarioMetadata (Name: "Text Input Controls", Description: "Tests all text input controls")]
  5. [ScenarioCategory ("Controls")]
  6. [ScenarioCategory ("Bug Repro")]
  7. class Text : Scenario {
  8. public override void Setup ()
  9. {
  10. var s = "This is a test intended to show how TAB key works (or doesn't) across text fields.";
  11. Win.Add (new TextField (s) {
  12. X = 5,
  13. Y = 1,
  14. Width = Dim.Percent (80),
  15. ColorScheme = Colors.Dialog
  16. });
  17. var textView = new TextView () {
  18. X = 5,
  19. Y = 3,
  20. Width = Dim.Percent (80),
  21. Height = Dim.Percent (40),
  22. ColorScheme = Colors.Dialog
  23. };
  24. textView.Text = s;
  25. Win.Add (textView);
  26. // BUGBUG: 531 - TAB doesn't go to next control from HexView
  27. var hexView = new HexView (new System.IO.MemoryStream(Encoding.ASCII.GetBytes (s))) {
  28. X = 5,
  29. Y = Pos.Bottom(textView) + 1,
  30. Width = Dim.Percent(80),
  31. Height = Dim.Percent(40),
  32. ColorScheme = Colors.Dialog
  33. };
  34. Win.Add (hexView);
  35. var dateField = new DateField (System.DateTime.Now) {
  36. X = 5,
  37. Y = Pos.Bottom (hexView) + 1,
  38. Width = Dim.Percent (40),
  39. ColorScheme = Colors.Dialog,
  40. IsShortFormat = false
  41. };
  42. Win.Add (dateField);
  43. var timeField = new TimeField (System.DateTime.Now) {
  44. X = Pos.Right(dateField) + 5,
  45. Y = Pos.Bottom (hexView) + 1,
  46. Width = Dim.Percent (40),
  47. ColorScheme = Colors.Dialog,
  48. IsShortFormat = false
  49. };
  50. Win.Add (timeField);
  51. }
  52. }
  53. }