diff --git a/FSharpExample/FSharpExample.fsproj b/FSharpExample/FSharpExample.fsproj index 47229e3f5..4ac06f71f 100644 --- a/FSharpExample/FSharpExample.fsproj +++ b/FSharpExample/FSharpExample.fsproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 @@ -14,7 +14,7 @@ - + diff --git a/FSharpExample/Program.fs b/FSharpExample/Program.fs index bc9fcbe82..bfeaef2ed 100644 --- a/FSharpExample/Program.fs +++ b/FSharpExample/Program.fs @@ -235,11 +235,11 @@ let ShowHex (top: Toplevel) = type MenuItemDetails () = inherit MenuItem () - new (title: ustring, help: string, action: Action) as this = + new (title: ustring, help: ustring, action: Action) as this = MenuItemDetails () then this.Title <- title - this.Help <- ustr help + this.Help <- help this.Action <- action static member Instance (mi: MenuItem) = @@ -362,10 +362,10 @@ let Main () = Width = Dim.Fill () - Dim.op_Implicit margin, Height = Dim.Fill () - Dim.op_Implicit margin) let menuItems = - [|MenuItemDetails (ustr "F_ind", "", Unchecked.defaultof<_>); - MenuItemDetails (ustr "_Replace", "", Unchecked.defaultof<_>); - MenuItemDetails (ustr "_Item1", "", Unchecked.defaultof<_>); - MenuItemDetails (ustr "_Also From Sub Menu", "", Unchecked.defaultof<_>)|] + [|MenuItemDetails (ustr "F_ind",ustr "", Unchecked.defaultof<_>); + MenuItemDetails (ustr "_Replace", ustr "", Unchecked.defaultof<_>); + MenuItemDetails (ustr "_Item1", ustr "", Unchecked.defaultof<_>); + MenuItemDetails (ustr "_Also From Sub Menu", ustr "", Unchecked.defaultof<_>)|] menuItems.[0].Action <- fun _ -> ShowMenuItem (menuItems.[0]) menuItems.[1].Action <- fun _ -> ShowMenuItem (menuItems.[1]) menuItems.[2].Action <- fun _ -> ShowMenuItem (menuItems.[2]) @@ -381,25 +381,29 @@ let Main () = MenuItem (ustr "_Disabled", ustring.Empty, (fun () -> ()), (fun () -> false)) Unchecked.defaultof<_> MenuItem (ustr "_Quit", ustring.Empty, (fun () -> if Quit() then top.Running <- false)) |]) - MenuBarItem (ustr "_Edit", + MenuBarItem (ustr "_Edit", [| MenuItem (ustr "_Copy", ustring.Empty, fun () -> Copy()) MenuItem (ustr "C_ut", ustring.Empty, fun () -> Cut()) MenuItem (ustr "_Paste", ustring.Empty, fun () -> Paste()) MenuBarItem (ustr "_Find and Replace", - [| menuItems.[0] - menuItems.[1] |]) - menuItems.[3] |]) + [| menuItems.[0] :> MenuItem + menuItems.[1] :> MenuItem |]) :> MenuItem + menuItems.[3] :> MenuItem + |]) MenuBarItem (ustr "_List Demos", [| MenuItem (ustr "Select _Multiple Items", ustring.Empty, (fun () -> ListSelectionDemo true)) MenuItem (ustr "Select _Single Item", ustring.Empty, (fun () -> ListSelectionDemo false)) |]) - MenuBarItem(ustr "A_ssorted", + MenuBarItem (ustr "A_ssorted", [| MenuItem (ustr "_Show text alignments", ustring.Empty, (fun () -> ShowTextAlignments())) MenuItem (ustr "_OnKeyDown/Press/Up", ustring.Empty, (fun () -> OnKeyDownPressUpDemo())) |]) - MenuBarItem(ustr "_Test Menu and SubMenus", + MenuBarItem (ustr "_Test Menu and SubMenus", [| MenuBarItem (ustr "SubMenu1Item_1", [| MenuBarItem (ustr "SubMenu2Item_1", [| MenuBarItem (ustr "SubMenu3Item_1", - [| menuItems.[2] |]) |]) |]) |]) + [| menuItems.[2] :> MenuItem |]) :> MenuItem + |]) :> MenuItem + |]) :> MenuItem + |]) MenuBarItem (ustr "_About...", ustr "Demonstrates top-level menu item", (fun () -> MessageBox.ErrorQuery (50, 7, ustr "Error", ustr "This is a demo app for gui.cs", ustr "Ok") |> ignore)) |]) menuKeysStyle <- new CheckBox (3, 25, ustr "UseKeysUpDownAsKeysLeftRight", true) menuKeysStyle.add_Toggled (Action (MenuKeysStyleToggled)) @@ -431,15 +435,17 @@ let Main () = win.Add bottom let bottom2 = new Label (ustr "This should go on the bottom of another top-level!") top.Add bottom2 - Application.Loaded <- Action ( - fun _ -> + top.add_LayoutComplete (Action + (fun e -> bottom.X <- win.X bottom.Y <- Pos.Bottom win - Pos.Top win - Pos.At margin bottom2.X <- Pos.Left win bottom2.Y <- Pos.Bottom win) + ) top.Add win top.Add (menu, statusBar) Application.Run () + Application.Shutdown (); module Demo = []