Fixes #4176. Removes View.MouseClick (#4450)

* Initial plan

* Add comprehensive MouseClick removal analysis

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix code review feedback on analysis document

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Add actual line numbers to analysis document

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Final polish on analysis document - clarify TextView

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Phase 3: Port 6 simple Views from MouseClick to Selecting/MouseBindings

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Phase 2: Port 10 Scenarios from MouseClick to Selecting/remove

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Update analysis document - Phases 2 & 3 complete

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix failing tests - Button multi-button support and Label focus handling

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Phase 4: Port ScrollBar from OnMouseClick to OnSelecting; remove analysis doc

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Phase 5: Update/remove tests that explicitly test MouseClick API

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Code cleanup

* Remove MouseClick event

Consolidated mouse event handling by removing the `MouseClick`
event and integrating its functionality into the `MouseEvent`
event. Simplified `MouseEventArgs` documentation and added
support for invoking commands bound to mouse events.

Reorganized code by removing `Mouse Pressed Events` and
`Mouse Click Events` regions, introducing a new `WhenGrabbed
Handlers` region. Updated tests to replace `MouseClick` with
`MouseEvent`, adjusted test logic, and improved variable
naming for clarity.

Removed redundant assertions and unused code related to
`MouseClick`. Improved event propagation logic to ensure
proper handling of unhandled events. Performed general code
cleanup to enhance readability and maintainability.

* Updated deep dives.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-06 14:41:20 -07:00
committed by GitHub
parent 0eafb5947e
commit dd12df7fb7
31 changed files with 811 additions and 670 deletions

View File

@@ -25,7 +25,7 @@ public class CharacterMap : Scenario
public override List<Key> GetDemoKeyStrokes ()
{
List<Key> keys = new ();
List<Key> keys = [];
for (var i = 0; i < 200; i++)
{
@@ -91,7 +91,7 @@ public class CharacterMap : Scenario
};
top.Add (jumpEdit);
_charMap.SelectedCodePointChanged += (sender, args) =>
_charMap.SelectedCodePointChanged += (_, args) =>
{
if (Rune.IsValid (args.Value))
{
@@ -134,27 +134,33 @@ public class CharacterMap : Scenario
_categoryList.Table = CreateCategoryTable (0, isDescending);
// if user clicks the mouse in TableView
_categoryList.MouseClick += (s, e) =>
{
_categoryList.ScreenToCell (e.Position, out int? clickedCol);
_categoryList.Selecting += (_, e) =>
{
// Only handle mouse clicks
if (e.Context is not CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
{
return;
}
if (clickedCol != null && e.Flags.HasFlag (MouseFlags.Button1Clicked))
{
EnumerableTableSource<UnicodeRange> table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
string prevSelection = table.Data.ElementAt (_categoryList.SelectedRow).Category;
isDescending = !isDescending;
_categoryList.ScreenToCell (mouseArgs.Position, out int? clickedCol);
_categoryList.Table = CreateCategoryTable (clickedCol.Value, isDescending);
if (clickedCol != null && mouseArgs.Flags.HasFlag (MouseFlags.Button1Clicked))
{
EnumerableTableSource<UnicodeRange> table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
string prevSelection = table.Data.ElementAt (_categoryList.SelectedRow).Category;
isDescending = !isDescending;
table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
_categoryList.Table = CreateCategoryTable (clickedCol.Value, isDescending);
_categoryList.SelectedRow = table.Data
.Select ((item, index) => new { item, index })
.FirstOrDefault (x => x.item.Category == prevSelection)
?.index
?? -1;
}
};
table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
_categoryList.SelectedRow = table.Data
.Select ((item, index) => new { item, index })
.FirstOrDefault (x => x.item.Category == prevSelection)
?.index
?? -1;
}
};
int longestName = UnicodeRange.Ranges.Max (r => r.Category.GetColumns ());
@@ -167,7 +173,7 @@ public class CharacterMap : Scenario
_categoryList.Width = _categoryList.Style.ColumnStyles.Sum (c => c.Value.MinWidth) + 4;
_categoryList.SelectedCellChanged += (s, args) =>
_categoryList.SelectedCellChanged += (_, args) =>
{
EnumerableTableSource<UnicodeRange> table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
_charMap.StartCodePoint = table.Data.ToArray () [args.NewRow].Start;
@@ -219,7 +225,7 @@ public class CharacterMap : Scenario
_errorLabel.Visible = true;
uint result = 0;
uint result;
if (jumpEdit.Text.Length == 1)
{
@@ -283,7 +289,7 @@ public class CharacterMap : Scenario
?? -1;
_categoryList.EnsureSelectedCellIsVisible ();
// Ensure the typed glyph is selected
// Ensure the typed glyph is selected
_charMap.SelectedCodePoint = (int)result;
_charMap.SetFocus ();

View File

@@ -35,7 +35,7 @@ public class ContextMenus : Scenario
Application.Run (_appWindow);
_appWindow.Dispose ();
_appWindow.KeyDown -= OnAppWindowOnKeyDown;
_appWindow.MouseClick -= OnAppWindowOnMouseClick;
_appWindow.Selecting -= OnAppWindowOnSelecting;
_winContextMenu?.Dispose ();
// Shutdown - Calling Application.Shutdown is required.
@@ -81,23 +81,26 @@ public class ContextMenus : Scenario
_appWindow.Add (_tfBottomRight);
_appWindow.KeyDown += OnAppWindowOnKeyDown;
_appWindow.MouseClick += OnAppWindowOnMouseClick;
_appWindow.Selecting += OnAppWindowOnSelecting;
CultureInfo originalCulture = Thread.CurrentThread.CurrentUICulture;
_appWindow.IsRunningChanged += (s, e) => {
_appWindow.IsRunningChanged += (_, e) => {
if (!e.Value)
{
Thread.CurrentThread.CurrentUICulture = originalCulture;
} };
}
void OnAppWindowOnMouseClick (object? s, MouseEventArgs e)
void OnAppWindowOnSelecting (object? s, CommandEventArgs e)
{
if (e.Flags == MouseFlags.Button3Clicked)
if (e.Context is CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
{
// ReSharper disable once AccessToDisposedClosure
_winContextMenu?.MakeVisible (e.ScreenPosition);
e.Handled = true;
if (mouseArgs.Flags == MouseFlags.Button3Clicked)
{
// ReSharper disable once AccessToDisposedClosure
_winContextMenu?.MakeVisible (mouseArgs.ScreenPosition);
e.Handled = true;
}
}
}
@@ -139,7 +142,7 @@ public class ContextMenus : Scenario
Title = "M_ore options",
SubMenu = new (
[
new MenuItem
new ()
{
Title = "_Setup...",
HelpText = "Perform setup",
@@ -153,7 +156,7 @@ public class ContextMenus : Scenario
),
Key = Key.T.WithCtrl
},
new MenuItem
new ()
{
Title = "_Maintenance...",
HelpText = "Maintenance mode",
@@ -194,7 +197,7 @@ public class ContextMenus : Scenario
if (index == -1)
{
// Create English because GetSupportedCutures doesn't include it
// Create English because GetSupportedCultures doesn't include it
culture.Id = "_English";
culture.Title = "_English";
culture.HelpText = "en-US";
@@ -240,38 +243,31 @@ public class ContextMenus : Scenario
public override List<Key> GetDemoKeyStrokes ()
{
List<Key> keys = new ();
keys.Add (Key.F10.WithShift);
keys.Add (Key.Esc);
keys.Add (Key.Space.WithCtrl);
keys.Add (Key.CursorDown);
keys.Add (Key.Enter);
keys.Add (Key.F10.WithShift);
keys.Add (Key.Esc);
keys.Add (Key.Tab);
keys.Add (Key.Space.WithCtrl);
keys.Add (Key.CursorDown);
keys.Add (Key.CursorDown);
keys.Add (Key.Enter);
keys.Add (Key.F10.WithShift);
keys.Add (Key.Esc);
keys.Add (Key.Tab);
keys.Add (Key.Space.WithCtrl);
keys.Add (Key.CursorDown);
keys.Add (Key.CursorDown);
keys.Add (Key.CursorDown);
keys.Add (Key.Enter);
keys.Add (Key.F10.WithShift);
keys.Add (Key.Esc);
List<Key> keys =
[
Key.F10.WithShift,
Key.Esc,
Key.Space.WithCtrl,
Key.CursorDown,
Key.Enter,
Key.F10.WithShift,
Key.Esc,
Key.Tab,
Key.Space.WithCtrl,
Key.CursorDown,
Key.CursorDown,
Key.Enter,
Key.F10.WithShift,
Key.Esc,
Key.Tab,
Key.Space.WithCtrl,
Key.CursorDown,
Key.CursorDown,
Key.CursorDown,
Key.Enter,
Key.F10.WithShift,
Key.Esc
];
return keys;
}

View File

@@ -73,17 +73,16 @@ public class EventLog : ListView
if (_viewToLog is { })
{
_viewToLog.Initialized += (s, args) =>
_viewToLog.Initialized += (s, _) =>
{
var sender = s as View;
Log ($"Initialized: {GetIdentifyingString (sender)}");
};
_viewToLog.MouseClick += (s, args) => { Log ($"MouseClick: {args}"); };
_viewToLog.MouseWheel += (s, args) => { Log ($"MouseWheel: {args}"); };
_viewToLog.HandlingHotKey += (s, args) => { Log ($"HandlingHotKey: {args.Context}"); };
_viewToLog.Selecting += (s, args) => { Log ($"Selecting: {args.Context}"); };
_viewToLog.Accepting += (s, args) => { Log ($"Accepting: {args.Context}"); };
_viewToLog.MouseWheel += (_, args) => { Log ($"MouseWheel: {args}"); };
_viewToLog.HandlingHotKey += (_, args) => { Log ($"HandlingHotKey: {args.Context}"); };
_viewToLog.Selecting += (_, args) => { Log ($"Selecting: {args.Context}"); };
_viewToLog.Accepting += (_, args) => { Log ($"Accepting: {args.Context}"); };
}
}
}

View File

@@ -18,17 +18,17 @@ public class ListColumns : Scenario
private TableView? _listColView;
private CheckBox? _alternatingColorsCheckBox;
private CheckBox? _alwaysUseNormalColorForVerticalCellLinesCheckBox;
private CheckBox? _bottomlineCheckBox;
private CheckBox? _bottomLineCheckBox;
private CheckBox? _cellLinesCheckBox;
private CheckBox? _cursorCheckBox;
private CheckBox? _expandLastColumnCheckBox;
private CheckBox? _orientVerticalCheckBox;
private CheckBox? _scrollParallelCheckBox;
private CheckBox? _smoothScrollingCheckBox;
private CheckBox? _toplineCheckBox;
private CheckBox? _topLineCheckBox;
/// <summary>
/// Builds a simple list in which values are the index. This helps testing that scrolling etc is working
/// Builds a simple list in which values are the index. This helps test that scrolling etc. is working
/// correctly and not skipping out values when paging
/// </summary>
/// <param name="items"></param>
@@ -112,25 +112,22 @@ public class ListColumns : Scenario
Normal = new (Color.White, Color.BrightBlue)
};
// if user clicks the mouse in TableView
_listColView.MouseClick += (s, e) => { _listColView.ScreenToCell (e.Position, out int? clickedCol); };
_listColView.KeyBindings.ReplaceCommands (Key.Space, Command.Accept);
// Setup menu checkboxes
_toplineCheckBox = new ()
_topLineCheckBox = new ()
{
Title = "_TopLine",
CheckedState = _listColView.Style.ShowHorizontalHeaderOverline ? CheckState.Checked : CheckState.UnChecked
};
_toplineCheckBox.CheckedStateChanged += (s, e) => ToggleTopline ();
_topLineCheckBox.CheckedStateChanged += (s, e) => ToggleTopline ();
_bottomlineCheckBox = new ()
_bottomLineCheckBox = new ()
{
Title = "_BottomLine",
CheckedState = _listColView.Style.ShowHorizontalBottomline ? CheckState.Checked : CheckState.UnChecked
};
_bottomlineCheckBox.CheckedStateChanged += (s, e) => ToggleBottomline ();
_bottomLineCheckBox.CheckedStateChanged += (s, e) => ToggleBottomline ();
_cellLinesCheckBox = new ()
{
@@ -221,11 +218,11 @@ public class ListColumns : Scenario
[
new MenuItem
{
CommandView = _toplineCheckBox
CommandView = _topLineCheckBox
},
new MenuItem
{
CommandView = _bottomlineCheckBox
CommandView = _bottomLineCheckBox
},
new MenuItem
{
@@ -422,12 +419,12 @@ public class ListColumns : Scenario
private void ToggleBottomline ()
{
if (_listColView is null || _bottomlineCheckBox is null)
if (_listColView is null || _bottomLineCheckBox is null)
{
return;
}
_listColView.Style.ShowHorizontalBottomline = _bottomlineCheckBox.CheckedState == CheckState.Checked;
_listColView.Style.ShowHorizontalBottomline = _bottomLineCheckBox.CheckedState == CheckState.Checked;
_listColView.Update ();
}
@@ -490,12 +487,12 @@ public class ListColumns : Scenario
private void ToggleTopline ()
{
if (_listColView is null || _toplineCheckBox is null)
if (_listColView is null || _topLineCheckBox is null)
{
return;
}
_listColView.Style.ShowHorizontalHeaderOverline = _toplineCheckBox.CheckedState == CheckState.Checked;
_listColView.Style.ShowHorizontalHeaderOverline = _topLineCheckBox.CheckedState == CheckState.Checked;
_listColView.Update ();
}

View File

@@ -143,7 +143,7 @@ public class Mouse : Scenario
cbHighlightOnPressed.CheckedState = demo.HighlightStates.HasFlag (MouseState.Pressed) ? CheckState.Checked : CheckState.UnChecked;
cbHighlightOnPressed.CheckedStateChanging += (s, e) =>
cbHighlightOnPressed.CheckedStateChanging += (_, e) =>
{
if (e.Result == CheckState.Checked)
{
@@ -181,7 +181,7 @@ public class Mouse : Scenario
cbHighlightOnPressedOutside.CheckedState = demo.HighlightStates.HasFlag (MouseState.PressedOutside) ? CheckState.Checked : CheckState.UnChecked;
cbHighlightOnPressedOutside.CheckedStateChanging += (s, e) =>
cbHighlightOnPressedOutside.CheckedStateChanging += (_, e) =>
{
if (e.Result == CheckState.Checked)
{
@@ -217,7 +217,7 @@ public class Mouse : Scenario
}
};
cbWantContinuousPresses.CheckedStateChanging += (s, e) =>
cbWantContinuousPresses.CheckedStateChanging += (_, _) =>
{
demo.WantContinuousButtonPressed = !demo.WantContinuousButtonPressed;
@@ -252,7 +252,7 @@ public class Mouse : Scenario
};
win.Add (label, appLog);
Application.MouseEvent += (sender, a) =>
Application.MouseEvent += (_, a) =>
{
int i = filterSlider.Options.FindIndex (o => o.Data == a.Flags);
@@ -270,7 +270,7 @@ public class Mouse : Scenario
X = Pos.Right (appLog) + 1,
Y = Pos.Top (label)
};
ObservableCollection<string> winLogList = new ();
ObservableCollection<string> winLogList = [];
var winLog = new ListView
{
@@ -283,7 +283,7 @@ public class Mouse : Scenario
};
win.Add (label, winLog);
clearButton.Accepting += (s, e) =>
clearButton.Accepting += (_, _) =>
{
appLogList.Clear ();
appLog.SetSource (appLogList);
@@ -291,7 +291,7 @@ public class Mouse : Scenario
winLog.SetSource (winLogList);
};
win.MouseEvent += (sender, a) =>
win.MouseEvent += (_, a) =>
{
int i = filterSlider.Options.FindIndex (o => o.Data == a.Flags);
@@ -302,12 +302,6 @@ public class Mouse : Scenario
}
};
win.MouseClick += (sender, a) =>
{
winLogList.Add ($"MouseClick: ({a.Position}) - {a.Flags} {count++}");
winLog.MoveDown ();
};
Application.Run (win);
win.Dispose ();
Application.Shutdown ();
@@ -322,8 +316,8 @@ public class Mouse : Scenario
Initialized += OnInitialized;
MouseLeave += (s, e) => { Text = "Leave"; };
MouseEnter += (s, e) => { Text = "Enter"; };
MouseLeave += (_, _) => { Text = "Leave"; };
MouseEnter += (_, _) => { Text = "Enter"; };
return;

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Collections.ObjectModel;
namespace UICatalog.Scenarios;
@@ -18,7 +16,7 @@ public class ScrollBarDemo : Scenario
Arrangement = ViewArrangement.Fixed
};
var demoFrame = new FrameView ()
var demoFrame = new FrameView
{
Title = "Demo View",
X = 0,
@@ -36,7 +34,7 @@ public class ScrollBarDemo : Scenario
X = Pos.AnchorEnd () - 5,
AutoShow = false,
ScrollableContentSize = 100,
Height = Dim.Fill()
Height = Dim.Fill ()
};
demoFrame.Add (scrollBar);
@@ -45,7 +43,7 @@ public class ScrollBarDemo : Scenario
X = Pos.AnchorEnd (),
Width = 5,
Height = Dim.Fill (),
SchemeName = "Error",
SchemeName = "Error"
};
demoFrame.Add (controlledList);
@@ -55,10 +53,9 @@ public class ScrollBarDemo : Scenario
int GetMaxLabelWidth (int groupId)
{
return demoFrame.SubViews.Max (
v =>
return demoFrame.SubViews.Max (v =>
{
if (v.Y.Has<PosAlign> (out var pos) && pos.GroupId == groupId)
if (v.Y.Has<PosAlign> (out PosAlign pos) && pos.GroupId == groupId)
{
return v.Text.GetColumns ();
}
@@ -71,7 +68,7 @@ public class ScrollBarDemo : Scenario
{
Text = "_Width/Height:",
TextAlignment = Alignment.End,
Y = Pos.Align (Alignment.Start, AlignmentModes.StartToEnd, groupId: 1),
Y = Pos.Align (Alignment.Start, AlignmentModes.StartToEnd, 1),
Width = Dim.Func (_ => GetMaxLabelWidth (1))
};
demoFrame.Add (lblWidthHeight);
@@ -80,17 +77,17 @@ public class ScrollBarDemo : Scenario
{
Value = 1,
X = Pos.Right (lblWidthHeight) + 1,
Y = Pos.Top (lblWidthHeight),
Y = Pos.Top (lblWidthHeight)
};
demoFrame.Add (scrollWidthHeight);
scrollWidthHeight.ValueChanging += (s, e) =>
{
if (e.NewValue < 1
|| (e.NewValue
> (scrollBar.Orientation == Orientation.Vertical
? scrollBar.SuperView?.GetContentSize ().Width
: scrollBar.SuperView?.GetContentSize ().Height)))
|| e.NewValue
> (scrollBar.Orientation == Orientation.Vertical
? scrollBar.SuperView?.GetContentSize ().Width
: scrollBar.SuperView?.GetContentSize ().Height))
{
// TODO: This must be handled in the ScrollSlider if Width and Height being virtual
e.Cancel = true;
@@ -108,7 +105,6 @@ public class ScrollBarDemo : Scenario
}
};
var lblOrientationLabel = new Label
{
Text = "_Orientation:",
@@ -128,28 +124,26 @@ public class ScrollBarDemo : Scenario
demoFrame.Add (osOrientation);
osOrientation.ValueChanged += (s, e) =>
{
if (osOrientation.Value == Orientation.Horizontal)
{
scrollBar.Orientation = Orientation.Vertical;
scrollBar.X = Pos.AnchorEnd () - 5;
scrollBar.Y = 0;
scrollBar.Width = scrollWidthHeight.Value;
scrollBar.Height = Dim.Fill ();
controlledList.Visible = true;
}
else
{
scrollBar.Orientation = Orientation.Horizontal;
scrollBar.X = 0;
scrollBar.Y = Pos.AnchorEnd ();
scrollBar.Height = scrollWidthHeight.Value;
scrollBar.Width = Dim.Fill ();
controlledList.Visible = false;
}
};
{
if (osOrientation.Value == Orientation.Horizontal)
{
scrollBar.Orientation = Orientation.Vertical;
scrollBar.X = Pos.AnchorEnd () - 5;
scrollBar.Y = 0;
scrollBar.Width = scrollWidthHeight.Value;
scrollBar.Height = Dim.Fill ();
controlledList.Visible = true;
}
else
{
scrollBar.Orientation = Orientation.Horizontal;
scrollBar.X = 0;
scrollBar.Y = Pos.AnchorEnd ();
scrollBar.Height = scrollWidthHeight.Value;
scrollBar.Width = Dim.Fill ();
controlledList.Visible = false;
}
};
var lblSize = new Label
{
@@ -169,20 +163,24 @@ public class ScrollBarDemo : Scenario
demoFrame.Add (scrollContentSize);
scrollContentSize.ValueChanging += (s, e) =>
{
if (e.NewValue < 0)
{
e.Cancel = true;
{
if (e.NewValue < 0)
{
e.Cancel = true;
return;
}
return;
}
if (scrollBar.ScrollableContentSize != e.NewValue)
{
scrollBar.ScrollableContentSize = e.NewValue;
controlledList.SetSource (new ObservableCollection<string> (Enumerable.Range (0, scrollBar.ScrollableContentSize).Select (n => $"{n:00000}")));
}
};
if (scrollBar.ScrollableContentSize != e.NewValue)
{
scrollBar.ScrollableContentSize = e.NewValue;
controlledList.SetSource (
new ObservableCollection<string> (
Enumerable.Range (0, scrollBar.ScrollableContentSize)
.Select (n => $"{n:00000}")));
}
};
var lblVisibleContentSize = new Label
{
@@ -202,20 +200,19 @@ public class ScrollBarDemo : Scenario
demoFrame.Add (visibleContentSize);
visibleContentSize.ValueChanging += (s, e) =>
{
if (e.NewValue < 0)
{
e.Cancel = true;
{
if (e.NewValue < 0)
{
e.Cancel = true;
return;
}
if (scrollBar.VisibleContentSize != e.NewValue)
{
scrollBar.VisibleContentSize = e.NewValue;
}
};
return;
}
if (scrollBar.VisibleContentSize != e.NewValue)
{
scrollBar.VisibleContentSize = e.NewValue;
}
};
var lblPosition = new Label
{
@@ -223,7 +220,6 @@ public class ScrollBarDemo : Scenario
TextAlignment = Alignment.End,
Y = Pos.Align (Alignment.Start, groupId: 1),
Width = Dim.Func (_ => GetMaxLabelWidth (1))
};
demoFrame.Add (lblPosition);
@@ -236,24 +232,24 @@ public class ScrollBarDemo : Scenario
demoFrame.Add (scrollPosition);
scrollPosition.ValueChanging += (s, e) =>
{
if (e.NewValue < 0)
{
e.Cancel = true;
{
if (e.NewValue < 0)
{
e.Cancel = true;
return;
}
return;
}
if (scrollBar.Position != e.NewValue)
{
scrollBar.Position = e.NewValue;
}
if (scrollBar.Position != e.NewValue)
{
scrollBar.Position = e.NewValue;
}
if (scrollBar.Position != e.NewValue)
{
e.Cancel = true;
}
};
if (scrollBar.Position != e.NewValue)
{
e.Cancel = true;
}
};
var lblOptions = new Label
{
@@ -263,11 +259,12 @@ public class ScrollBarDemo : Scenario
Width = Dim.Func (_ => GetMaxLabelWidth (1))
};
demoFrame.Add (lblOptions);
var autoShow = new CheckBox
{
Y = Pos.Top (lblOptions),
X = Pos.Right (lblOptions) + 1,
Text = $"_AutoShow",
Text = "_AutoShow",
CheckedState = scrollBar.AutoShow ? CheckState.Checked : CheckState.UnChecked
};
autoShow.CheckedStateChanging += (s, e) => scrollBar.AutoShow = e.Result == CheckState.Checked;
@@ -296,9 +293,9 @@ public class ScrollBarDemo : Scenario
TextAlignment = Alignment.End,
Y = Pos.Align (Alignment.Start, groupId: 1),
Width = Dim.Func (_ => GetMaxLabelWidth (1))
};
demoFrame.Add (lblScrolled);
Label scrolled = new ()
{
X = Pos.Right (lblScrolled) + 1,
@@ -347,43 +344,41 @@ public class ScrollBarDemo : Scenario
void AppOnInitialized (object sender, EventArgs e)
{
scrollBar.ScrollableContentSizeChanged += (s, e) =>
{
eventLog.Log ($"SizeChanged: {e.Value}");
{
eventLog.Log ($"SizeChanged: {e.Value}");
if (scrollContentSize.Value != e.Value)
{
scrollContentSize.Value = e.Value;
}
};
if (scrollContentSize.Value != e.Value)
{
scrollContentSize.Value = e.Value;
}
};
scrollBar.SliderPositionChanged += (s, e) =>
{
eventLog.Log ($"SliderPositionChanged: {e.Value}");
eventLog.Log ($" Position: {scrollBar.Position}");
scrollSliderPosition.Text = e.Value.ToString ();
};
{
eventLog.Log ($"SliderPositionChanged: {e.Value}");
eventLog.Log ($" Position: {scrollBar.Position}");
scrollSliderPosition.Text = e.Value.ToString ();
};
scrollBar.Scrolled += (s, e) =>
{
eventLog.Log ($"Scrolled: {e.Value}");
eventLog.Log ($" SliderPosition: {scrollBar.GetSliderPosition ()}");
scrolled.Text = e.Value.ToString ();
};
{
eventLog.Log ($"Scrolled: {e.Value}");
eventLog.Log ($" SliderPosition: {scrollBar.GetSliderPosition ()}");
scrolled.Text = e.Value.ToString ();
};
scrollBar.PositionChanged += (s, e) =>
{
eventLog.Log ($"PositionChanged: {e.Value}");
scrollPosition.Value = e.Value;
controlledList.Viewport = controlledList.Viewport with { Y = e.Value };
};
{
eventLog.Log ($"PositionChanged: {e.Value}");
scrollPosition.Value = e.Value;
controlledList.Viewport = controlledList.Viewport with { Y = e.Value };
};
controlledList.ViewportChanged += (s, e) =>
{
eventLog.Log ($"ViewportChanged: {e.NewViewport}");
scrollBar.Position = e.NewViewport.Y;
};
}
Application.Run (app);

View File

@@ -610,29 +610,35 @@ public class TableEditor : Scenario
};
// if user clicks the mouse in TableView
_tableView!.MouseClick += (s, e) =>
{
if (_currentTable == null)
{
return;
}
_tableView!.Selecting += (s, e) =>
{
if (_currentTable == null)
{
return;
}
_tableView!.ScreenToCell (e.Position, out int? clickedCol);
// Only handle mouse clicks
if (e.Context is not CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
{
return;
}
if (clickedCol != null)
{
if (e.Flags.HasFlag (MouseFlags.Button1Clicked))
{
// left click in a header
SortColumn (clickedCol.Value);
}
else if (e.Flags.HasFlag (MouseFlags.Button3Clicked))
{
// right click in a header
ShowHeaderContextMenu (clickedCol.Value, e);
}
}
};
_tableView!.ScreenToCell (mouseArgs.Position, out int? clickedCol);
if (clickedCol != null)
{
if (mouseArgs.Flags.HasFlag (MouseFlags.Button1Clicked))
{
// left click in a header
SortColumn (clickedCol.Value);
}
else if (mouseArgs.Flags.HasFlag (MouseFlags.Button3Clicked))
{
// right click in a header
ShowHeaderContextMenu (clickedCol.Value, mouseArgs);
}
}
};
_tableView!.KeyBindings.ReplaceCommands (Key.Space, Command.Accept);

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text;
namespace UICatalog.Scenarios;
@@ -9,12 +6,11 @@ namespace UICatalog.Scenarios;
[ScenarioCategory ("Text and Formatting")]
public class TextAlignmentAndDirection : Scenario
{
internal class AlignmentAndDirectionView : View
{
public AlignmentAndDirectionView ()
{
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent;
ViewportSettings = ViewportSettingsFlags.Transparent;
BorderStyle = LineStyle.Dotted;
}
}
@@ -30,15 +26,15 @@ public class TextAlignmentAndDirection : Scenario
var txt = $"Hello World{Environment.NewLine}HELLO WORLD{Environment.NewLine}世界 您好";
SchemeManager.AddScheme ("TextAlignmentAndDirection1", new Scheme { Normal = new (Color.Black, Color.Gray) });
SchemeManager.AddScheme ("TextAlignmentAndDirection2", new Scheme { Normal = new (Color.Black, Color.DarkGray) });
SchemeManager.AddScheme ("TextAlignmentAndDirection1", new () { Normal = new (Color.Black, Color.Gray) });
SchemeManager.AddScheme ("TextAlignmentAndDirection2", new () { Normal = new (Color.Black, Color.DarkGray) });
List<View> singleLineLabels = new (); // single line
List<View> multiLineLabels = new (); // multi line
List<View> singleLineLabels = []; // single line
List<View> multiLineLabels = []; // multi line
// Horizontal Single-Line
// Horizontal Single-Line
var labelHL = new Label
Label labelHL = new ()
{
X = 0,
Y = 0,
@@ -46,10 +42,10 @@ public class TextAlignmentAndDirection : Scenario
Height = 1,
TextAlignment = Alignment.End,
SchemeName = "Dialog",
Text = "Start",
Text = "Start"
};
var labelHC = new Label
Label labelHC = new ()
{
X = 0,
Y = 1,
@@ -60,7 +56,7 @@ public class TextAlignmentAndDirection : Scenario
Text = "Center"
};
var labelHR = new Label
Label labelHR = new ()
{
X = 0,
Y = 2,
@@ -71,7 +67,7 @@ public class TextAlignmentAndDirection : Scenario
Text = "End"
};
var labelHJ = new Label
Label labelHJ = new ()
{
X = 0,
Y = 3,
@@ -82,7 +78,7 @@ public class TextAlignmentAndDirection : Scenario
Text = "Fill"
};
var txtLabelHL = new View
View txtLabelHL = new ()
{
X = Pos.Right (labelHL) + 1,
Y = Pos.Y (labelHL),
@@ -91,10 +87,10 @@ public class TextAlignmentAndDirection : Scenario
SchemeName = "TextAlignmentAndDirection1",
TextAlignment = Alignment.Start,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
var txtLabelHC = new View
View txtLabelHC = new ()
{
X = Pos.Right (labelHC) + 1,
Y = Pos.Y (labelHC),
@@ -103,10 +99,10 @@ public class TextAlignmentAndDirection : Scenario
SchemeName = "TextAlignmentAndDirection2",
TextAlignment = Alignment.Center,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
var txtLabelHR = new View
View txtLabelHR = new ()
{
X = Pos.Right (labelHR) + 1,
Y = Pos.Y (labelHR),
@@ -115,10 +111,10 @@ public class TextAlignmentAndDirection : Scenario
SchemeName = "TextAlignmentAndDirection1",
TextAlignment = Alignment.End,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
var txtLabelHJ = new View
View txtLabelHJ = new ()
{
X = Pos.Right (labelHJ) + 1,
Y = Pos.Y (labelHJ),
@@ -127,7 +123,7 @@ public class TextAlignmentAndDirection : Scenario
SchemeName = "TextAlignmentAndDirection2",
TextAlignment = Alignment.Fill,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
singleLineLabels.Add (txtLabelHL);
@@ -146,7 +142,7 @@ public class TextAlignmentAndDirection : Scenario
// Vertical Single-Line
var labelVT = new Label
Label labelVT = new ()
{
X = Pos.AnchorEnd () - 6,
Y = 0,
@@ -159,7 +155,7 @@ public class TextAlignmentAndDirection : Scenario
};
labelVT.TextFormatter.WordWrap = false;
var labelVM = new Label
Label labelVM = new ()
{
X = Pos.AnchorEnd () - 4,
Y = 0,
@@ -172,7 +168,7 @@ public class TextAlignmentAndDirection : Scenario
};
labelVM.TextFormatter.WordWrap = false;
var labelVB = new Label
Label labelVB = new ()
{
X = Pos.AnchorEnd () - 2,
Y = 0,
@@ -185,7 +181,7 @@ public class TextAlignmentAndDirection : Scenario
};
labelVB.TextFormatter.WordWrap = false;
var labelVJ = new Label
Label labelVJ = new ()
{
X = Pos.AnchorEnd (),
Y = 0,
@@ -198,7 +194,7 @@ public class TextAlignmentAndDirection : Scenario
};
labelVJ.TextFormatter.WordWrap = false;
var txtLabelVT = new View
View txtLabelVT = new ()
{
X = Pos.X (labelVT),
Y = Pos.Bottom (labelVT) + 1,
@@ -208,11 +204,11 @@ public class TextAlignmentAndDirection : Scenario
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.Start,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
txtLabelVT.TextFormatter.WordWrap = false;
var txtLabelVM = new View
View txtLabelVM = new ()
{
X = Pos.X (labelVM),
Y = Pos.Bottom (labelVM) + 1,
@@ -222,11 +218,11 @@ public class TextAlignmentAndDirection : Scenario
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.Center,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
txtLabelVM.TextFormatter.WordWrap = false;
var txtLabelVB = new View
View txtLabelVB = new ()
{
X = Pos.X (labelVB),
Y = Pos.Bottom (labelVB) + 1,
@@ -236,11 +232,11 @@ public class TextAlignmentAndDirection : Scenario
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.End,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
txtLabelVB.TextFormatter.WordWrap = false;
var txtLabelVJ = new View
View txtLabelVJ = new ()
{
X = Pos.X (labelVJ),
Y = Pos.Bottom (labelVJ) + 1,
@@ -250,7 +246,7 @@ public class TextAlignmentAndDirection : Scenario
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.Fill,
Text = txt,
ViewportSettings = Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent
ViewportSettings = ViewportSettingsFlags.Transparent
};
txtLabelVJ.TextFormatter.WordWrap = false;
@@ -270,7 +266,7 @@ public class TextAlignmentAndDirection : Scenario
// Multi-Line
var container = new View
View container = new ()
{
X = 0,
Y = Pos.Bottom (txtLabelHJ),
@@ -280,7 +276,7 @@ public class TextAlignmentAndDirection : Scenario
//SchemeName = "TextAlignmentAndDirection2"
};
var txtLabelTL = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelTL = new ()
{
X = 0,
Y = 1,
@@ -289,11 +285,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.Start,
VerticalTextAlignment = Alignment.Start,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelTL.TextFormatter.MultiLine = true;
var txtLabelTC = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelTC = new ()
{
X = Pos.Right (txtLabelTL),
Y = 1,
@@ -302,11 +298,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.Center,
VerticalTextAlignment = Alignment.Start,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelTC.TextFormatter.MultiLine = true;
var txtLabelTR = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelTR = new ()
{
X = Pos.Right (txtLabelTC),
Y = 1,
@@ -315,11 +311,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.End,
VerticalTextAlignment = Alignment.Start,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelTR.TextFormatter.MultiLine = true;
var txtLabelML = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelML = new ()
{
X = Pos.X (txtLabelTL),
Y = Pos.Bottom (txtLabelTL),
@@ -328,11 +324,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.Start,
VerticalTextAlignment = Alignment.Center,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelML.TextFormatter.MultiLine = true;
var txtLabelMC = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelMC = new ()
{
X = Pos.X (txtLabelTC),
Y = Pos.Bottom (txtLabelTC),
@@ -341,11 +337,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.Center,
VerticalTextAlignment = Alignment.Center,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelMC.TextFormatter.MultiLine = true;
var txtLabelMR = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelMR = new ()
{
X = Pos.X (txtLabelTR),
Y = Pos.Bottom (txtLabelTR),
@@ -354,11 +350,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.End,
VerticalTextAlignment = Alignment.Center,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelMR.TextFormatter.MultiLine = true;
var txtLabelBL = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelBL = new ()
{
X = Pos.X (txtLabelML),
Y = Pos.Bottom (txtLabelML),
@@ -367,11 +363,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.Start,
VerticalTextAlignment = Alignment.End,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelBL.TextFormatter.MultiLine = true;
var txtLabelBC = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelBC = new ()
{
X = Pos.X (txtLabelMC),
Y = Pos.Bottom (txtLabelMC),
@@ -380,11 +376,11 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.Center,
VerticalTextAlignment = Alignment.End,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelBC.TextFormatter.MultiLine = true;
var txtLabelBR = new AlignmentAndDirectionView
AlignmentAndDirectionView txtLabelBR = new ()
{
X = Pos.X (txtLabelMR),
Y = Pos.Bottom (txtLabelMR),
@@ -393,7 +389,7 @@ public class TextAlignmentAndDirection : Scenario
TextAlignment = Alignment.End,
VerticalTextAlignment = Alignment.End,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
Text = txt
};
txtLabelBR.TextFormatter.MultiLine = true;
@@ -429,7 +425,7 @@ public class TextAlignmentAndDirection : Scenario
// Edit Text
var label = new Label
Label label = new ()
{
X = 1,
Y = Pos.Bottom (container) + 1,
@@ -438,7 +434,7 @@ public class TextAlignmentAndDirection : Scenario
Text = "Edit Text:"
};
var editText = new TextView
TextView editText = new ()
{
X = Pos.Right (label) + 1,
Y = Pos.Top (label),
@@ -447,19 +443,6 @@ public class TextAlignmentAndDirection : Scenario
Text = txt
};
editText.MouseClick += (s, m) =>
{
foreach (View v in singleLineLabels)
{
v.Text = editText.Text;
}
foreach (View v in multiLineLabels)
{
v.Text = editText.Text;
}
};
app.KeyUp += (s, m) =>
{
foreach (View v in singleLineLabels)
@@ -479,7 +462,7 @@ public class TextAlignmentAndDirection : Scenario
// JUSTIFY CHECKBOX
var justifyCheckbox = new CheckBox
CheckBox justifyCheckbox = new ()
{
X = Pos.Right (container) + 1,
Y = Pos.Y (container) + 1,
@@ -492,7 +475,7 @@ public class TextAlignmentAndDirection : Scenario
// JUSTIFY OPTIONS
var justifyOptions = new OptionSelector
OptionSelector justifyOptions = new ()
{
X = Pos.Left (justifyCheckbox) + 1,
Y = Pos.Y (justifyCheckbox) + 1,
@@ -509,7 +492,7 @@ public class TextAlignmentAndDirection : Scenario
// WRAP CHECKBOX
var wrapCheckbox = new CheckBox
CheckBox wrapCheckbox = new ()
{
X = Pos.Right (container) + 1,
Y = Pos.Bottom (justifyOptions),
@@ -520,28 +503,28 @@ public class TextAlignmentAndDirection : Scenario
wrapCheckbox.CheckedState = wrapCheckbox.TextFormatter.WordWrap ? CheckState.Checked : CheckState.UnChecked;
wrapCheckbox.CheckedStateChanging += (s, e) =>
{
if (e.Result == CheckState.Checked)
{
foreach (View t in multiLineLabels)
{
t.TextFormatter.WordWrap = false;
}
}
else
{
foreach (View t in multiLineLabels)
{
t.TextFormatter.WordWrap = true;
}
}
};
{
if (e.Result == CheckState.Checked)
{
foreach (View t in multiLineLabels)
{
t.TextFormatter.WordWrap = false;
}
}
else
{
foreach (View t in multiLineLabels)
{
t.TextFormatter.WordWrap = true;
}
}
};
app.Add (wrapCheckbox);
List<TextDirection> directionsEnum = Enum.GetValues (typeof (TextDirection)).Cast<TextDirection> ().ToList ();
var directionOptions = new OptionSelector
OptionSelector directionOptions = new ()
{
X = Pos.Right (container) + 1,
Y = Pos.Bottom (wrapCheckbox) + 1,
@@ -552,24 +535,24 @@ public class TextAlignmentAndDirection : Scenario
};
directionOptions.ValueChanged += (s, ev) =>
{
bool justChecked = justifyCheckbox.CheckedState == CheckState.Checked;
{
bool justChecked = justifyCheckbox.CheckedState == CheckState.Checked;
if (justChecked)
{
ToggleJustify (true);
}
if (justChecked)
{
ToggleJustify (true);
}
foreach (View v in multiLineLabels.Where (v => ev.Value is { }))
{
v.TextDirection = (TextDirection)ev.Value!.Value;
}
foreach (View v in multiLineLabels.Where (v => ev.Value is { }))
{
v.TextDirection = (TextDirection)ev.Value!.Value;
}
if (justChecked)
{
ToggleJustify (false);
}
};
if (justChecked)
{
ToggleJustify (false);
}
};
app.Add (directionOptions);
@@ -617,14 +600,17 @@ public class TextAlignmentAndDirection : Scenario
case 0:
t.VerticalTextAlignment = Alignment.Fill;
t.TextAlignment = data!.h;
break;
case 1:
t.VerticalTextAlignment = data!.v;
t.TextAlignment = Alignment.Fill;
break;
case 2:
t.VerticalTextAlignment = Alignment.Fill;
t.TextAlignment = Alignment.Fill;
break;
}
}
@@ -635,14 +621,17 @@ public class TextAlignmentAndDirection : Scenario
case 0:
t.TextAlignment = Alignment.Fill;
t.VerticalTextAlignment = data!.v;
break;
case 1:
t.TextAlignment = data!.h;
t.VerticalTextAlignment = Alignment.Fill;
break;
case 2:
t.TextAlignment = Alignment.Fill;
t.VerticalTextAlignment = Alignment.Fill;
break;
}
}

View File

@@ -60,7 +60,7 @@ public class TreeViewFileSystem : Scenario
};
win.Add (_detailsFrame);
_treeViewFiles.MouseClick += TreeViewFiles_MouseClick;
_treeViewFiles.Selecting += TreeViewFiles_Selecting;
_treeViewFiles.KeyDown += TreeViewFiles_KeyPress;
_treeViewFiles.SelectionChanged += TreeViewFiles_SelectionChanged;
@@ -556,17 +556,23 @@ public class TreeViewFileSystem : Scenario
}
}
private void TreeViewFiles_MouseClick (object? sender, MouseEventArgs obj)
private void TreeViewFiles_Selecting (object? sender, CommandEventArgs e)
{
if (_treeViewFiles is null)
{
return;
}
// if user right clicks
if (obj.Flags.HasFlag (MouseFlags.Button3Clicked))
// Only handle mouse clicks
if (e.Context is not CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
{
IFileSystemInfo? rightClicked = _treeViewFiles.GetObjectOnRow (obj.Position.Y);
return;
}
// if user right clicks
if (mouseArgs.Flags.HasFlag (MouseFlags.Button3Clicked))
{
IFileSystemInfo? rightClicked = _treeViewFiles.GetObjectOnRow (mouseArgs.Position.Y);
// nothing was clicked
if (rightClicked is null)
@@ -576,8 +582,8 @@ public class TreeViewFileSystem : Scenario
ShowContextMenu (
new (
obj.Position.X + _treeViewFiles.Frame.X,
obj.Position.Y + _treeViewFiles.Frame.Y + 2
mouseArgs.Position.X + _treeViewFiles.Frame.X,
mouseArgs.Position.Y + _treeViewFiles.Frame.Y + 2
),
rightClicked
);

View File

@@ -86,18 +86,19 @@ public class ViewExperiments : Scenario
//App?.Popover!.Visible = true;
}
testFrame.MouseClick += TestFrameOnMouseClick;
void TestFrameOnMouseClick (object sender, MouseEventArgs e)
testFrame.Selecting += (sender, e) =>
{
if (e.Flags == MouseFlags.Button3Clicked)
if (e.Context is CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
{
popoverView.X = e.ScreenPosition.X;
popoverView.Y = e.ScreenPosition.Y;
//App?.Popover = popoverView;
//App?.Popover!.Visible = true;
if (mouseArgs.Flags == MouseFlags.Button3Clicked)
{
popoverView.X = mouseArgs.ScreenPosition.X;
popoverView.Y = mouseArgs.ScreenPosition.Y;
//App?.Popover = popoverView;
//App?.Popover!.Visible = true;
}
}
}
};
testFrame.Add (button);