MudBlazor MudForm POST on Enter - keyboard-events

I'm looking for a way to post a MudForm upon pressing Enter from any control inside the form, without checking each keyboardevent argument and filtering for Enter, and without binding the listener to each form control in every MudForm.
The goal is to post any MudForm across my project by pressing Enter as a default behavior.

Related

Do not confirm Edit on Press ENTER with AG GRID REACT

Is there any way to stop the default behaviour of an AG GRID cell on enter event ?
I tried e.preventDefault() nothing seems to stop it from exiting edit mode when I press enter, I'm trying to do a custom logic on press enter and it's not allowing me to!
After further looking, I found a function called supressKeyboardEvent it takes params as arguments and returns a boolean (Whether should the event be suppressed or not).
For more details refer to this official Ag grid source : https://www.ag-grid.com/javascript-data-grid/keyboard-navigation/#suppress-keyboard-events

How to set focus on textbox and button simultaneously in WinForm

I want to set focus on a button while caret is present in textbox and user can still enter data to textbox. But when user presses enter key, button press will be simulated.
I am currently using a work around to solve this problem by handling onKeyDown event and checking for enter key. But problem is there is no clue for user to understand this as there is not blue border around the button that indicates focus on button.
Here is a example of what I want to implement (user can enter text in textbox while focus is on :
I have tried to search on google and StackOverflow but could not find any relevant result.
This is a fundamental Windows principle. It's not possible to have 2 controls (windows) focused at the same time.
So the focus should be inside the text box. But you can get the visual indication needed by setting the ok button as AcceptButton of the form (you might also want to set cancel button as CancelButton).
In the form constructor, load event or using designer:
this.AcceptButton = okButton;
There is no need to handle KeyDown event - as soon as the text box is not multiline, pressing Enter while the focus is inside it will generate ok button click. The same applies for the button set as CancelButton when you press ESC.

Re-open the DropDown of an AutoCompleteBox in Silverlight when a user presses Enter

If a user types a few characters into an AutoCompleteBox, the DropDown is displayed as expected.
If the user then clicks elsewhere on the page, this removes the focus from the AutoCompleteBox, and the DropDown disappears... also as expected.
However, if a user then returns focus to the AutoCompleteBox, and wants to redisplay the DropDown, filtering on the characters already there, the instinct seems to be to press the Enter key to re-filter/re-display the results. This, however, does not happen.
I've managed to capture the Enter key event (must use KeyUp instead of KeyDown), but I'm not sure how to make the DropDown re-appear at that point. Ideas?
Just assign true to the IsDropDownOpen property:-
myACB.IsDropDownOpen = true;

WinForms Accept Button Annoyance

I have a base panel class that has (among other things) three buttons. I use subclasses of this base class in two different config dialogues. Both dialogues have an OK button set as the accept button.
In one of the dialogues, if I click one of the buttons in the base class, focus immediately returns to the OK button, so pressing the enter key works as expected.
In the other dialogue, focus remains wth the button in the base class that was clicked if it is enabled, or moves to the next button if the clicked button is no longer enabled.
There is no code that handles the base class button click events in either of the derived classes.
Ideas anyone?
I'm not sure what's going on in your first dialog because it doesn't seem to be operating the way I would expect it to. The second dialog sounds more like the standard behavior.
In Windows Forms, the AcceptButton property only comes into play when pressing Enter doesn't otherwise cause any actions. In both of your examples, clicking on a button should move the focus to that button, and subsequently pressing Enter would cause another click on that button.
In any event, I think it's generally preferable to stick with the Windows user interface guidelines and not automatically change the input focus back to the OK button. If the user clicks on one of the other buttons, the focus should stay there until they move it.
i don't know what language you are using, but the button class should have a focus method that will highlite it for enter pressing. in the click method, or when you open the dialog you can call this method to make the button you want get the form's focus
c#
myButton.Focus();

Should the Enter key always trigger the default button, no matter which child control has the focus

I have a form with a default OK button, and a Cancel button. I have a treeview with nodes that can be edited, i.e. you can double-click them or press F2 to open another form.
Now, I've never liked that F2 shortcut, and now that I'm enabling treeview label edition, it's even worse. My first reaction when testing the form was to press "Enter" to edit the selected node, but doing this would go against the normal default button behavior.
Your opinion: Should an application always enforce the default button being triggered with the Enter key? If so what kind of shortcut should an application use to "edit the selected item"?
Definitely not... Confuses our users no end that enter doesn't select what they have highlighted.
Absolutely no. The Enter key is often used to fire the default button but equally often not. For example, Enter generally means new line in a multiline textbox.
Enter sounds like a good bet in this scenario. F2 tends to mean "Edit" in Windows.
However, if this is a long-standing application you may just irritate users who are used to F2.

Resources