I have a lot of data-entryists using my ASP.NET application and we have all been wondering if there are any keyboard keys or shortcuts that you can press to trigger:
Check a RadioButton
Uncheck a RadioButton
Check a Checkbox
Uncheck a Checkbox
I know that you can write Javascript and do it yourself, but do any keyboard keys/shortcuts already exist without using the mouse?
Spacebar is the standard button for those, with arrow keys to move between radio buttons.
Related
I have been unable to figure out how to easily rearrange the menu bar selections that I have created in Qt Designer. Older documentation indicates that I can press the left click mouse button on a selection and then drag and drop it into a new location but this feature does not seem to work in this version.
I am trying to move "Load Database" above the "Exit" option. I would imagine I could just delete the "Exit" menu selection and add it again but I was hoping there would be an easier option in case this happens again.
To do so you need to go in the ui editor.
Then click on File. Press and hold on the item you want to move. Move it.
Below you can see the exact same thing done in QT 4.12.3 and Window 10.
Press file
Press and hold on the desired item
Drag the selected item where you want
Now the 'Save as' is above 'Save'
Select your action in Designer
Press Ctrl + Up/Down
Ctrl + Up/Down is working for me (Qt desinger 5.15.0)
I want to keep focus on TextField. For example i am typing something then tap to button. The focus on TextField is moving to button, that's why keyboard is automatically hiding on Android. I am using Qt 5.9.2. Thanks in advance!
In Qt Quick Controls 2, each control has a focusPolicy property which determines how the control gets focus. The default for controls like Button is Qt.StrongFocus, which means that buttons get focus after being clicked or tabbed into. If you're seeing that a control has focus and you don't want it to, just set its focusPolicy to Qt.NoFocus:
focusPolicy: Qt.NoFocus
I have write a code for radio button click by using XPath but it is not click on radio button during execution of code.
My code is:
driver.FindElement(By.XPath("//a[contains(id(),rptShoppingServiceGroup_dlAddons_2_ctl01_2)]")).Click();
Kindly help how to button select particular radio button and after selection it move to another radio button.
Thanks in advance.
Actually the click() works, but the webdriver can't properly refresh the user interface...
The unique methode i've found to refresh that is to use the submit() function on it.
Like :
myRadioBtn.click();
myRadioBtn.submit();
tell me what's up =)
It might be case that you're checking radio button which is already checked. Hence now, you have radio button unchecked which you don't want(you want radio button to be checked). First check whether radio button is checked. If it's checked, don't click on it(otherwise, it'll result into uncheck of radio button). If it's not checked, then click on it so it will be checked.
button = driver.FindElement(By.XPath("//a[contains(id(),rptShoppingServiceGroup_dlAddons_2_ctl01_2)]"))
if (!button.isSelected()){
button.click();
assetTrue(button.isSelected)
}
Do you want RadioButton checked?
if yes, try ...Checked=true
var radioButton = driver.FindElement(By.XPath("//a[contains(id(),rptShoppingServiceGroup_dlAddons_2_ctl01_2)]"));
radioButton.Checked=true;
(or radioButton.Click())
I want to design a layout with a PushButton and TextEdit. The TextEdit is disabled at first and only enabled when the PushButton is clicked. When the TextEdit is enabled, it should also be selected.
In other words, what I mean is I can start typing straightway in the TextEdit without click to select it after it is enabled. Like when you open a new tab in your browser, the text cursor will automatically go to the address bar without any clicking.
Thanks.
You can use the QWidget::setFocus() function, docs here.
In GUI dialogs, most applications provide for keyboard control as follows:
Enter key - presses the default button. (Default is usually indicated with a bold button border.)
Esc key - presses the Cancel or close button.
Space key - presses widget that currently has keyboard focus.
Tab key - advances focus to next widget.
Question is, when keyboard focus is on a widget that is a button, should the default button be changed to be the one with focus?
I see some issues with this behavior:
The display noise of redrawing buttons to unbold the outline of original default button and rebold the button under focus as being new default.
The Space key is now somewhat redundant with Enter key.
There is no keyboard accelerator to get the normal default button now (Usually the OK button).
However, it seems the trend has been in this direction to change the default button with focus change to another button. What is the rationale for this departure from the early GUIs? It would seem to provide less functionality given there is no way to press the original default button. Did people find that the original model was too complicated for users to understand? I would think keyboard control of dialogs would be a task for advanced users who would have no trouble understanding the model and prefer to have accelerator for current button (Space) and original default button (Enter) at all times.
Note that Qt for one is supporting the change: QPushButton's autoDefault property is responsible for the behavior of changing the default button. By default its value is true. Therefore, you must take extra action to set it to false for all buttons, to prevent them from becoming the default button when focused.
This is not a "departure from the early GUIs", at least not if by "early GUIs", you mean Windows 1.0. The behavior that you describe has been this way since the beginning.
The focused button is always "pushed" when the Enter key is pressed. The default button is only triggered in the following two situations:
The default button has the focus (which it does by default), or
The focus is on a control that does not process Enter key presses (such as a static control, or a single-line textbox that does not have the ES_WANTRETURN style flag set).
The famous Win32 blogger Raymond Chen has a post explaining this behavior (focus specifically on the last two quoted paragraphs):
A dialog box maintains the concept of a "default button" (which is always a pushbutton). The default button is typically drawn with a distinctive look (a heavy outline or a different color) and indicates what action the dialog box will take when you hit Enter. Note that this is not the same as the control that has the focus.
For example, open the Run dialog from the Start menu. Observe that the OK button is the default button; it has a different look from the other buttons. But focus is on the edit control. Your typing goes to the edit control, until you hit Enter; the Enter activates the default button, which is OK.
As you tab through the dialog, observe what happens to the default button. When the dialog box moves focus to a pushbutton, that pushbutton becomes the new default button. But when the dialog box moves focus to something that isn't a pushbutton at all, the OK button resumes its position as the default button.
The dialog manager remebers which control was the default button when the dialog was initially created, and when it moves focus to something that isn't a button, it restores that original button as the default button.
The behavior that I would expect is:
If I press enter when the window just pop up, it should press the default button
If I press tab, I start navigating through the widgets. In this case there are two options:
2.1 I press enter - this event should be delivered to the focused widget. There's no need to change the default button - simply hand the event to the focused widget.
2.2 I press escape. In this case, everything should go back to the state after the window is created.
Notes:
I come from a mixed background - I don't know if I learned this in windows, linux or Mobile OSes! This is just how I expect things to work out.
I don't use the space key (didn't know it's functionality)