What is the proper name for a multibutton? - qt

I'm trying to design a UI in Qt and I can't find anywhere in the designer a button which can be "droped down" like combobox. What I mean by that is that I would like to have this button with his "default" option choosen so if I like it I would have to just click on it but if I would like to choose different option I would be able to clik the little arrow on the right side of this button and then pick option suitable for me at that moment.

You're looking for a QToolButton that has a set of actions or a menu set on it. From the documentation, the QToolButton::ToolButtonPopupMode...
Describes how a menu should be popped up for tool buttons that has a menu set or contains a list of actions.
Of it's values, the two that I see most frequently are DelayedPopup:
After pressing and holding the tool button down for a certain amount of time (the timeout is style dependant, see QStyle::SH_ToolButton_PopupDelay), the menu is displayed. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply browses back to the previous page. If the user presses and holds the button down for a while, the tool button shows a menu containing the current history list
And MenuButtonPopup:
In this mode the tool button displays a special arrow to indicate that a menu is present. The menu is displayed when the arrow part of the button is pressed.

Related

Handling keyboard navigation in nsDialogs

I'm using nsDialogs to create a custom page in the installer of my app, where users can decide between standard and portable installation.
For this, I create two radio button controls via NSD_CreateRadioButton so that users can decide between the two installation modes.
After receiving feedback from blind users, I'd like to add the possibility to navigate via keyboard between those two radio buttons. So far, pressing the Tab key navigates directly to the next button in the lower navigation bar and not to the . Arrow up / Arrow down have no effect.
How can I add this possibility for keyboard navigation using nsDialogs?
If you use the ${NSD_Create*} macros in nsDialogs.nsh then the WS_TABSTOP style will be set for button controls and you can Tab to them. However, the tab order is: the bottom buttons before the buttons in your dialog.
Assign a access key to allow a user to access a control directly. You do that by adding a ampersand (&) to the text label before a specific character:
${NSD_CreateRadioButton} 0 13u 100% 15u "Click &Me" ; Activate by pressing Alt+M
Pop $0
${NSD_CreateRadioButton} 0 30u 100% 15u "&Or Me"
Pop $0
The arrow keys should also work once one of the radio buttons have focus. The WS_GROUP style also plays a role in keyboard navigation if you have multiple groups of unrelated radio buttons.
I've found a solution to this problem, by experimenting with the suggestions #Anders provided.
In between the two calls to NSD_CreateRadioButton I had another call to NSD_CreateLabel which apparently mixed up the grouping between the two radio buttons.
When I create the radio buttons by two subsequent calls to NSD_CreateRadioButton and then add the describing labels, navigation via Arrow up and Arrow down works. If there is another call to NSD_Create* in between, it breaks the grouping.

If spacebar opens dropdowns across all browsers, why is my onchange triggered menu considered inaccessible

Background: for Windows users on Chrome and IE, dropdowns that reload or change the page are no good for accessibility. As soon as a user presses the down arrow button, the page reloads. This means that the user can only access the very first menu option. Here is an example: http://html.cita.illinois.edu/script/onchange/onchange-example.php
This is covered in the WCAG rule:
“Changing the setting of any user interface component does not automatically cause a change of context unless the user has been advised of the behavior before using the component. (Level A)”
EXCEPT the user can very easily open up the dropdown and explore all the options without triggering an onchange event. The user does this with a space bar press. This is a very commonly known keyboard trick that I've seen all tested users to already be aware of or be able to figure out quickly.
In my system, we are using a dropdown for pagination in long directories.
EG: "you are on page [1^] of 16" (with the [1^] being a browser default dropdown menu). The designers will not allow any kind of visual [go] button. This happens across thousands of pages, javascript fixes I've seen need to account for every dropdown, and this is impossible on our case.
Using space bar, the user can see all the options and make a selection from anywhere on the list using only the keyboard. So why are dropdown page menus that automatically reload onchange still considered inaccessible? And would they be considered accessible if we included screen-reader only text which said "press space bar to open this menu, making a selection will load your next page"
Well except that in Firefox, the keyboard command is actually F4, you are correct - this is not a WCAG 2 violation but rather a best practice
Here is a page where you can test this: http://dylanb.github.io/onchange_select.html

Show context menu of QSystemTrayIcon without user click

I have a QSystemTrayIcon, that displays a QMenu on click, but I want to display the menu as soon as the tray icon is displayed. I have tried calling the show method on the QMenu, but the menu only seems to display when it is clicked. Any idea on how to change this behaviour?
I'm not sure if it's possible to trigger the behaviour triggered by operating system when user clicks the system tray, but at least you should be able to use QMenu::popup method to just show the menu returned by QSystemTrayIcon::contextMenu method.
Note that you should use the menu's size hint, when you calculate the menu postion relative to QSystemTrayIcon::geometry. Also you may need to use QDesktopWidget::availableGeometry to make sure the menu pops up inside the screen, no matter where the task bar is.

Keyboard control of GUI dialogs - Should default button change with focus?

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)

Flex 4 - creating pop-up without disabling background / drag image without mouseup trigger?

Sorry to bother you, but I was hoping you could help me. We are currently building a new web site and have run into some issues with our programmer. I am trying to do some research to see if we can find a way for my issue to be solved so that I can let my programmer know.
First issue:
Go here: http://tinyurl.com/276we3f
At the pop-up just enter some example text.
Now, when you hover over any text boxes on the left of the card, you will see that the text boxes become highlighted with a border. If you click in a text box, a properties pop-up appears that allows you to change the font, color, alignment, etc. When you click close, it will take you back to the product and will highlight the text. I want the user to be able to click anywhere within a text box to type new text. For example, in the bottom text box, where it says "join us to celebrate", the user should be able to click anywhere in that text to change the wording. They might want it to say "join me to celebrate" instead of "join us to celebrate". However, if they click next to the word "us" so that they can change it....the pop-up appears.
Is there a way to just have a pop-up appear to the side and not have the background grayed out and disabled?
Also, is there a way to be able to click anywhere in the text box to edit just certain words or letters?
Second and final question:
If you click on "Click to add photo", you will see a pop-up appear that allows you to upload an image, edit it, etc. After uploading the image, I want the user to be able to move the image around with their mouse by dragging it and positioning it in the exact spot that they want it in. We also have the arrows where they can click the up, down, left or right arrow in the image editor pop-up....but I would like for them to be able to drag the image with their mouse as well. We know how to enable dragging of the image. However, the problem occurs when the user releases the mouse button. On the mouseup when the user is done dragging....the pop-up will appear since the pop-up is triggered by the release of the mouse button.
Does that make sense?
Sorry for the long message and THANKS SO MUCH for your help!
For the first part of your question, when showing the dialog box for the properties of the text area, you can pop it up as a non-modal window. This means the properties dialog will show but will not lock out the rest of the UI, enabling the user to change the text however they like. It also means the background does not blur/grey out. To pop up a window in a non-modal state, call PopUpManager.createPopUp (or PopUpManager.addPopUp) with the third parameter (modal) set to false.
For the second issue, set a member variable such as "isDragging" to true when you detect that the user is dragging the image around. Then on mouse up, only display the pop up if isDragging is false.
Hope that helps.

Resources