|
@@ -235,11 +235,11 @@ let ShowHex (top: Toplevel) =
|
|
|
|
|
|
type MenuItemDetails () =
|
|
type MenuItemDetails () =
|
|
inherit MenuItem ()
|
|
inherit MenuItem ()
|
|
- new (title: ustring, help: string, action: Action) as this =
|
|
|
|
|
|
+ new (title: ustring, help: ustring, action: Action) as this =
|
|
MenuItemDetails ()
|
|
MenuItemDetails ()
|
|
then
|
|
then
|
|
this.Title <- title
|
|
this.Title <- title
|
|
- this.Help <- ustr help
|
|
|
|
|
|
+ this.Help <- help
|
|
this.Action <- action
|
|
this.Action <- action
|
|
|
|
|
|
static member Instance (mi: MenuItem) =
|
|
static member Instance (mi: MenuItem) =
|
|
@@ -362,10 +362,10 @@ let Main () =
|
|
Width = Dim.Fill () - Dim.op_Implicit margin,
|
|
Width = Dim.Fill () - Dim.op_Implicit margin,
|
|
Height = Dim.Fill () - Dim.op_Implicit margin)
|
|
Height = Dim.Fill () - Dim.op_Implicit margin)
|
|
let menuItems =
|
|
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.[0].Action <- fun _ -> ShowMenuItem (menuItems.[0])
|
|
menuItems.[1].Action <- fun _ -> ShowMenuItem (menuItems.[1])
|
|
menuItems.[1].Action <- fun _ -> ShowMenuItem (menuItems.[1])
|
|
menuItems.[2].Action <- fun _ -> ShowMenuItem (menuItems.[2])
|
|
menuItems.[2].Action <- fun _ -> ShowMenuItem (menuItems.[2])
|
|
@@ -381,25 +381,29 @@ let Main () =
|
|
MenuItem (ustr "_Disabled", ustring.Empty, (fun () -> ()), (fun () -> false))
|
|
MenuItem (ustr "_Disabled", ustring.Empty, (fun () -> ()), (fun () -> false))
|
|
Unchecked.defaultof<_>
|
|
Unchecked.defaultof<_>
|
|
MenuItem (ustr "_Quit", ustring.Empty, (fun () -> if Quit() then top.Running <- false)) |])
|
|
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 "_Copy", ustring.Empty, fun () -> Copy())
|
|
MenuItem (ustr "C_ut", ustring.Empty, fun () -> Cut())
|
|
MenuItem (ustr "C_ut", ustring.Empty, fun () -> Cut())
|
|
MenuItem (ustr "_Paste", ustring.Empty, fun () -> Paste())
|
|
MenuItem (ustr "_Paste", ustring.Empty, fun () -> Paste())
|
|
MenuBarItem (ustr "_Find and Replace",
|
|
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",
|
|
MenuBarItem (ustr "_List Demos",
|
|
[| MenuItem (ustr "Select _Multiple Items", ustring.Empty, (fun () -> ListSelectionDemo true))
|
|
[| MenuItem (ustr "Select _Multiple Items", ustring.Empty, (fun () -> ListSelectionDemo true))
|
|
MenuItem (ustr "Select _Single Item", ustring.Empty, (fun () -> ListSelectionDemo false)) |])
|
|
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 "_Show text alignments", ustring.Empty, (fun () -> ShowTextAlignments()))
|
|
MenuItem (ustr "_OnKeyDown/Press/Up", ustring.Empty, (fun () -> OnKeyDownPressUpDemo())) |])
|
|
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 "SubMenu1Item_1",
|
|
[| MenuBarItem (ustr "SubMenu2Item_1",
|
|
[| MenuBarItem (ustr "SubMenu2Item_1",
|
|
[| MenuBarItem (ustr "SubMenu3Item_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)) |])
|
|
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 <- new CheckBox (3, 25, ustr "UseKeysUpDownAsKeysLeftRight", true)
|
|
menuKeysStyle.add_Toggled (Action<bool> (MenuKeysStyleToggled))
|
|
menuKeysStyle.add_Toggled (Action<bool> (MenuKeysStyleToggled))
|
|
@@ -431,15 +435,17 @@ let Main () =
|
|
win.Add bottom
|
|
win.Add bottom
|
|
let bottom2 = new Label (ustr "This should go on the bottom of another top-level!")
|
|
let bottom2 = new Label (ustr "This should go on the bottom of another top-level!")
|
|
top.Add bottom2
|
|
top.Add bottom2
|
|
- Application.Loaded <- Action<Application.ResizedEventArgs> (
|
|
|
|
- fun _ ->
|
|
|
|
|
|
+ top.add_LayoutComplete (Action<View.LayoutEventArgs>
|
|
|
|
+ (fun e ->
|
|
bottom.X <- win.X
|
|
bottom.X <- win.X
|
|
bottom.Y <- Pos.Bottom win - Pos.Top win - Pos.At margin
|
|
bottom.Y <- Pos.Bottom win - Pos.Top win - Pos.At margin
|
|
bottom2.X <- Pos.Left win
|
|
bottom2.X <- Pos.Left win
|
|
bottom2.Y <- Pos.Bottom win)
|
|
bottom2.Y <- Pos.Bottom win)
|
|
|
|
+ )
|
|
top.Add win
|
|
top.Add win
|
|
top.Add (menu, statusBar)
|
|
top.Add (menu, statusBar)
|
|
Application.Run ()
|
|
Application.Run ()
|
|
|
|
+ Application.Shutdown ();
|
|
|
|
|
|
module Demo =
|
|
module Demo =
|
|
[<EntryPoint>]
|
|
[<EntryPoint>]
|