TableView CellActivationKey - Right Click #2376
Answered
by
tznind
aaronhudon
asked this question in
Q&A
-
Does the |
Beta Was this translation helpful? Give feedback.
Answered by
tznind
Feb 22, 2023
Replies: 1 comment
-
It might be easier to use the MouseClick event directly. For example using Terminal.Gui;
using System.Data;
Application.Init();
var win = new Window("Example App (Ctrl+Q to quit)");
var dt = new DataTable();
dt.Columns.Add("Hey");
dt.Columns.Add("There");
dt.Columns.Add("Friend");
dt.Rows.Add("yay","woot","Fun!");
dt.Rows.Add("yay","wootttt","Fun!");
dt.Rows.Add("yay","woott","Fun!");
dt.Rows.Add("yay","woo","Fun!");
var tv = new TableView(dt){
Width = Dim.Fill(),
Height = Dim.Fill(),
};
tv.MouseClick += (e)=>
{
if(e.MouseEvent.Flags == MouseFlags.Button3Clicked)
{
var clicked = tv.ScreenToCell(e.MouseEvent.X,e.MouseEvent.Y);
if(clicked.HasValue && clicked.Value.Y < tv.Table.Rows.Count)
{
MessageBox.Query("Right Click",$"You clicked {clicked.Value.X},{clicked.Value.Y}","Ok");
}
}
};
win.Add(tv);
Application.Run(win);
Application.Shutdown(); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aaronhudon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It might be easier to use the MouseClick event directly. For example