Libgdx - Making a drop-down menu/settings screen - drop-down-menu

I'm looking to make a drop-down menu and drop-down settings screen but I couldn't find any resources for making these in Libgdx. Would like some pointers to good resources for this specific type of interface or a quick example.
Thanks!

SelectBox is in LibGDX can be used for drop-down list, it allows one of a number of values to be chosen from a list. And for pop-up window you can use Dialog.
stage=new Stage();
Skin skin=new Skin(Gdx.files.internal("skin/glassy-ui.json"));
dialog=new Dialog("Setting",skin);
dialog.setSize(200,200);
dialog.setPosition(Gdx.graphics.getWidth()/2-100,Gdx.graphics.getHeight()/2-100);
final SelectBox<String> selectBox=new SelectBox<String>(skin);
selectBox.setItems("XYZ","ABC","PQR","LMN");
dialog.getContentTable().defaults().pad(10);
dialog.getContentTable().add(selectBox);
stage.addActor(dialog);
Gdx.input.setInputProcessor(stage);
Output

Related

UI guidelines - should a control get focus when changed?

I have a window which shows a table on the left half. On the right half I display properties of the item which is selected in the table. The user can now change these properties.
The properties are represented by different kinds of controls: textFields, sliders, numberSteppers and popUpButtons.
The user can - besides using the mouse - use the tab key to navigate through the UI Elements. When the table has the focus tab will select the first editable item on the right side, then tab walks through the items and after the last item will go to the table again.
When the table has focus and I change the value of a popUpButton or move a sliderthe default behaviour of the API (Apple's Cocoa) is to change the value but keep the focus on the table.
My intuition would tell me that after changing a control element it should have the focus (i.e. become firstResponder). But I checked some of macOS' preference panes and they behave similarly.
In Apple's Human Interface Guidelines I do not find mention of that specific topic.
So my question is:
Is there a guideline or at least best practice an app should follow regarding if a control element like a popUpButton or slidershould get the focus when clicked or edited?

Xcode-like Navigator control

What type of control is this? Some sort of Segment control but without borders? It works like a menu in that you can mouse down and drag... it will highlight as you drag and pick the one you release on.
How can I do something similar?
The big difference I need is to allow multiple selection which will show different sets of details in the area below it. I can do this with a series of NSButtons, but don't get the drag-over "menu" effect.
Ideas?
In the past, I have come across two example of implementation of Xcode-like inspector views:
https://github.com/malcommac/DMTabBar
https://github.com/smic/InspectorTabBar
Some time has passed, so they seem to me more the style of Xcode 4, but they should be ready to adapt to the new appearance.

"Always show selection" doesn't work on CListCtrl in list mode

I want a user to be able to select item(s) in my CListCtrl and then click on a button to act on those items. But when the focus is lost from the list, the selection is no longer shown, even if I set 'Always show selection' to true:
This happens both in the dialog test facility, and in my compiled application. I use list-mode, and have no icons, only text.
To reproduce:
Create a new dialog in the resource editor
Place a list-view control.
Set View = List in the properties
Set Always Show Selection = True in the properties
Add a button to the dialog
Press Ctrl-T to test the dialog
Select item(s) on the list, then press the button
..and the text is not visibly selected at all. Or is it... I can just
barely sort of see some very very faint selection in my screenshot - I
think. It's so faint I am not 100% certain it's there!
In addition to my comments: well, there you have it - they are selected, and in a different color, but it seems your screen settings are a bit off. Maybe your color settings, a high contrast mode, or the color setting for selected items in Windows.
The gray color in your screenshot is: #f7f3f7 - light gray, so you might have a problem seeing it, depending on the settings.
An interesting and very lightweight tool to check those things (zoom in, see the color values) is ZoomPlus. I use it every day, and there seems to be source code available too.

PropertySheet with a TreeView (using WinAPI)

In my WinAPI program I use PropertySheet for a settings dialog box. I use property sheet with pages (tabs), i.e. I use PSH_PROPSHEETPAGE flag. But the software now have too many parameters for such a type of property sheet. So I want to use PropertySheet with treeview: the treeview on the left and the page with paramerets for the currently selected item in the treeview - on the right.
How can I do this? Can my current property sheet be modified for this and how?
(using only WinAPI, no MFC)
Standard property sheet is no longer good enough for you, so you basically have two choices here. You can either design a window (modal or modeless, dialog based or not) to host all your controls in a single view, with tree view, possibly tab control as well, and showing/hiding elements to follow tree view selection. And you will move all your controls into this window.
Or instead, you can create a similar window which hosts property pages. On tree selection change you will switch property pages as if they are selected by tabs in standard property sheet. The point is that you can use your existing pages intact making this new settings windows imitating behavior of standard property sheet. This is perhaps a more complicated thing to do, but should be flexible enough to do once and accept various pages, and you don't also need to touch your existing pages code leaving it good for both standard and this custom sheet with a tree.
Both ways assume you need to do quite some work since you are giving up using a standard piece of code - the property sheet window.

How to maintain focus on menu after clicking a menu command

Simple version
Is there any way to maintain focus on menu after clicking a menu command?
Detailed version
Specifically, I've made a menu with some menu item with checked property. The problem is that each time I click checked menu item the menu lose its focus. It can be pretty annoying when there is a number of menu item with checked property and I want to manipulate them at once.
The most elegant solution for the problem would be maintaining focus on menu, but I can't find a way to apply it. Is it possible? And if so, what's the way to do that?
Even if there would a solution for it, sooner or later you will enter a situation in which a numerical or string property is changed via the menu, and then it becomes even impossible to keep the focus on the menu (while the dialog requesting the number or string is on the screen).
The first, simple alternative would be to put the checkable menu items on a toolbar or ribbon (just like Word does with Bold, Italic, Underline, ...). Numerical/string properties can then also be added on the toolbar or ribbon.
A second alternative could be to have a more complete configuration dialog in which the user can change all the configuration items. The configuration dialog can co-exist with the current checkable items, so users simply changing one check and users changing many properties all get a quick way of doing what they want.
You might also pose this question on https://ux.stackexchange.com/ (this sibling site is more oriented towards good user interface practices).

Resources