Slipstreaming the 'comment entry' process

I have the Grindstone 4 workflow pretty well dialled, however once I return to my PC, and I am prompted to enter a comment, I can type this straight away - however then must grab the mouse to click OK. A very minor tweak would be to please allow ‘Enter’ to be used to accept the comment, as I assume fewer people require a new line to be added during comment than to accept the comment itself. Would very much appreciate an option for this, if not default. Thank you for your time

Hey there! Congrats on your first post in the new forums.

Did you mean for this to be related to extensions (i.e. are you asking how one would do this using extensions), or are you merely asking for a behavior change in Grindstone out of the box?

Hi Daniel - thanks for the response. More of an out-of-the box I suppose, unless such an option was a part of an UI extension? Apologies if this is in the wrong place :slight_smile:

No problem, pal. :wink:

I’ll have a look at getting that done for ya.

No problem. I moved your topic to the proper category.

Awesome, thanks a lot Daniel. Another ‘nice to have’ would be an option for a default selection when returning to an unattended computer. ‘Continue timing on what I left off’ or what not, and have the ‘OK’ button pre-selected, so that a simple strike of the Enter key will get things back on track where they were previously. Cheers

I had a good time implementing your first request tonight.

Added ModifiedAcceptsReturnBehavior.cs:

using System.Linq;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;

namespace Quantum.Client.Windows
    public static class ModifiedAcceptsReturnBehavior
        public static readonly DependencyProperty IsEnabledProperty =
            DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(ModifiedAcceptsReturnBehavior), new PropertyMetadata(false, OnIsEnabledChanged));

        public static bool GetIsEnabled(DependencyObject obj) => (bool)obj.GetValue(IsEnabledProperty);

        static void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
            if (e.Property == IsEnabledProperty && sender is TextBox textBox && e.NewValue is bool newValue)
                if (newValue)
                    textBox.PreviewKeyDown += PreviewKeyDown;
                    textBox.PreviewKeyDown -= PreviewKeyDown;

        private static void PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
            if ((App.Configuration?.EnterConfirmsDialogsInMultilineTextboxes ?? true) &&
                sender is TextBox textBox &&
                textBox.AcceptsReturn &&
                e.Key == System.Windows.Input.Key.Enter &&
                !System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.LeftCtrl) &&
                !System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.RightCtrl) &&
                !System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.LeftAlt) &&
                !System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.RightAlt) &&
                !System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.LeftShift) &&
                !System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.RightShift) &&
                Window.GetWindow(textBox).FindVisualChildren<Button>().FirstOrDefault(b => b.IsDefault) is Button defaultButton &&
                new ButtonAutomationPeer(defaultButton).GetPattern(PatternInterface.Invoke) is IInvokeProvider defaultButtonInvokeProvider)
                e.Handled = true;

        public static void SetIsEnabled(DependencyObject obj, bool value) => obj.SetValue(IsEnabledProperty, value);

Invoked the new guy in the default text box style:

<Style x:Key="AppTextBoxStyle" TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxStyle}">
    <!-- other stuff I didn't paste in here -->
    <Setter Property="local:ModifiedAcceptsReturnBehavior.IsEnabled" Value="True" />

That’s right, bruh. Took less than fifteen minutes to implement. Still got it.

If you want to see it for yourself, check out the topic for the upcoming preview release for instructions.

Ahh, let’s see how hard that would be…

1 Like

Alright, @lachiewatson, while I’m not so sure that I’d feel comfortable changing the default selection on the away dialog for UX reasons, what if I tried to meet you half-way by making the away dialog more keyboard navigable. You know what, I’m doing this anyway. Let’s see how it feels for ya.

1 Like

Hi Daniel. Thanks again for the ‘Enter’ to accept comment…this is MASSIVE convenience!

1 Like

CTRL + Enter dismisses the box and saves my comments for me without any configuration required out-of-box. My only mouse interaction is selecting the relevant option in the “Noticed you’ve been away” dialog.

Yeah, we made it just Shift + Enter before release to the stable channel. BTW, welcome aboard @Rae!

1 Like

Thank you @lachiewatson for making the requests and thank you @daniel.henry for implementing them!

Personally I write multiline comments much more often than not, so I have the first request turned off so it is easier for me to write my comments without accidentally hitting ‘Enter’ and closing the box when I didn’t want to. That would have been a pain, so thanks for making it an option!

As for the second request, I’ve been annoyed by the default not being ‘continue what I was timing’ for a while, but being able to just arrow down with the keyboard real quick makes it sooooo much better. I don’t even mind now that it isn’t the default since having a keyboard control for that makes it that much better. Thanks!

1 Like