From 72ee72807b67a396634a9caadb0da9aec7524959 Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 3 Jun 2020 03:35:49 +0100 Subject: [PATCH] ColorScheme inside the View instance. Updating OnKeyDownPressUpDemo to reflect the news changes. (#594) --- FSharpExample/Program.fs | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/FSharpExample/Program.fs b/FSharpExample/Program.fs index 4824df648..62202bd22 100644 --- a/FSharpExample/Program.fs +++ b/FSharpExample/Program.fs @@ -333,9 +333,9 @@ type Demo() = class end X = Pos.At(0), Y = Pos.At(0), Width = Dim.Fill () - Dim.op_Implicit(1), - Height = Dim.Fill () - Dim.op_Implicit(2) + Height = Dim.Fill () - Dim.op_Implicit(2), + ColorScheme = Colors.TopLevel ) - listView.ColorScheme <- Colors.TopLevel container.Add (listView) let KeyDownPressUp(keyEvent : KeyEvent, updown : string) = @@ -344,25 +344,7 @@ type Demo() = class end | "Down" | "Up" | "Press" -> - let mutable (msg : string) = sprintf "Key %5s : " updown - if (keyEvent.Key &&& Key.ShiftMask) <> Key.Unknown - then msg <- msg + "Shift " - if (keyEvent.Key &&& Key.CtrlMask) <> Key.Unknown - then msg <- msg + "Ctrl " - if (keyEvent.Key &&& Key.AltMask) <> Key.Unknown - then msg <- msg + "Alt " - msg <- msg + if (keyEvent.KeyValue &&& (int)Key.CharMask) > 26 then (string)keyEvent.KeyValue else (string)keyEvent.Key - list.Add (msg) - | _ -> - if (keyEvent.Key &&& Key.ShiftMask) <> Key.Unknown - then list.Add (sprintf "Key %s : Shift " updown) - else if (keyEvent.Key &&& Key.CtrlMask) <> Key.Unknown - then list.Add (sprintf "Key %s : Ctrl " updown) - else if (keyEvent.Key &&& Key.AltMask) <> Key.Unknown - then list.Add (sprintf "Key %s : Alt " updown) - else if ((int)keyEvent.KeyValue &&& (int)Key.CharMask) > 26 - then list.Add (sprintf "Key %s : %s" updown (keyEvent.KeyValue.ToString())) - else list.Add (sprintf "Key %s : %s" updown (keyEvent.Key.ToString())) + list.Add (keyEvent.ToString ()) listView.MoveDown (); container.KeyDown.Add(fun (e : View.KeyEventEventArgs) -> KeyDownPressUp (e.KeyEvent, "Down") |> ignore)