Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8865 Allow keyboard on manager node #8883

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 23 additions & 16 deletions ApsimNG/Views/TreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -689,28 +689,35 @@ private void OnButtonPress(object sender, ButtonPressEventArgs e)
timer.Stop();
if (e.Event.Button == 1 && e.Event.Type == Gdk.EventType.ButtonPress)
{
TreePath path;
TreeViewColumn col;
// Get the clicked location
if (treeview1.GetPathAtPos((int)e.Event.X, (int)e.Event.Y, out path, out col))
if(treeview1.IsFocus)
{
// See if the click was on the current selection
TreePath selPath;
TreeViewColumn selCol;
treeview1.GetCursor(out selPath, out selCol);
if (selPath != null && path.Compare(selPath) == 0)
TreePath path;
TreeViewColumn col;
// Get the clicked location
if (treeview1.GetPathAtPos((int)e.Event.X, (int)e.Event.Y, out path, out col))
{
// Check where on the row we are located, allowing 16 pixels for the image, and 2 for its border
Gdk.Rectangle rect = treeview1.GetCellArea(path, col);
if (e.Event.X > rect.X + 18)
// See if the click was on the current selection
TreePath selPath;
TreeViewColumn selCol;
treeview1.GetCursor(out selPath, out selCol);
if (selPath != null && path.Compare(selPath) == 0)
{
// We want this to be a bit longer than the double-click interval, which is normally 250 milliseconds
timer.Interval = Settings.Default.DoubleClickTime + 10;
timer.AutoReset = false;
timer.Start();
// Check where on the row we are located, allowing 16 pixels for the image, and 2 for its border
Gdk.Rectangle rect = treeview1.GetCellArea(path, col);
if (e.Event.X > rect.X + 18)
{
// We want this to be a bit longer than the double-click interval, which is normally 250 milliseconds
timer.Interval = Settings.Default.DoubleClickTime + 10;
timer.AutoReset = false;
timer.Start();
}
}
}
}
else
{
treeview1.GrabFocus();
}
}
}
catch (Exception err)
Expand Down