Opened 12 years ago

Last modified 11 years ago

#1532 new enhancement

GUI - Dropdown improvements

Reported by: historic_bruno Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords: design
Cc: Patch:

Description (last modified by historic_bruno)

  • Implement disabled sprite and text color ("sprite_disabled", "textcolor_disabled")
  • Implement hover/mouseover sprite and text color ("sprite_over", "textcolor_over")
  • Implement pressed sprite and text color ("sprite_pressed"?, "textcolor_pressed")
  • Dynamic size adjustment: currently the max height of the dropdown list is specified with "dropdown_size", it would be nice if it could adjust dynamically to fit in the window. Maybe as an option.
  • Jump to the position of the currently selected item, when opening the dropdown. Same problem that CList has.
  • Remember input focus when list is closed, so the dropdown can be navigated by arrow keys (scrollwheel too?) #698 is related.

Dropdowns are a bit weird, the property names are not intuitive or well-documented, here's an explanation I found in styles.xml:

Dropdown button:
	* size=shape
	* sprite=bkg
	* textcolor=text color
Dropdown arrow button:
	* button_width=shape
	* sprite2=bkg
	* sprite2_pressed=bkg clicked
Dropdown list:
	* buffer_zone=margin
	* dropdown_size=height
	* sprite_list=bkg
	* sprite_selectarea=bkg hovered item
	* textcolor_selected=text color hobered item

See GUI_-_Drop-down.

Attachments (1)

DropDownEasyAccess.patch (3.1 KB ) - added by wraitii 11 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 by ben, 12 years ago

In 12107:

Increases maximum dropdown list size slightly, allowing up to 10 lines at a time (must be careful that it fits on 1024x768!). Refs #1532

comment:2 by historic_bruno, 12 years ago

Description: modified (diff)

comment:3 by wraitii, 11 years ago

I'm pretty sure the 5th point is now in, perhaps even for lists. the 4th point in #698 is dealt with in the patch below.

Some comments on said patch:
-It doesn't handle lists since I'm not too sure what lists actually are. Code should be fairly easily transposable if needed.
-it will deal with any character a-z, 0-9, and spaces. You can input up to 100 characters (far more than required).
-It will reset itself every second. Sounds reasonable enough
-I also made the "return to position when reopening" and this kind of selection not make the selected element at the very top of the dropdown (I'm not clear, check in-game with a dropdown and you'll see what I mean: basically the selected element is now on the 3rd row.) I find it both more useful and aesthetically pleasing, it's an easy change back if needed.

by wraitii, 11 years ago

Attachment: DropDownEasyAccess.patch added

comment:4 by zoot, 11 years ago

Hmm. IMO, resetting every x seconds seems a bit bizarre. I think the convention on all three supported OSes is to just iterate through items beginning with the letter pressed.

comment:5 by wraitii, 11 years ago

By resetting I mean you'll start a new "word", so to speak.

comment:6 by zoot, 11 years ago

Right. I guess what I am asking is why not just use the standard behavior of iterating?

comment:7 by wraitii, 11 years ago

Well I used the OSX way, which is about what I have done. Apparently Windows/Linux iterate through files starting with n when you keep pressing n, right?

comment:8 by zoot, 11 years ago

Yes, they do. I am not really familiar with OSX, so that could explain the differing expectations.

comment:9 by wraitii, 11 years ago

It's up to design choice then. Perhaps I can change the implementation dependent on the platform to mimic the OS usage. On Windows/linux, it you type another key, it adds it to the original letter (ie "acro" gives you "acro") or it simply goes to the first with that letter ("acro" gives you A, then C, then R, then O?)

comment:10 by Erik Johansson, 11 years ago

Would it be possible to keep track of how long time it takes between key presses? I.e. if you press "acro" almost instantly it searches for the entire word, if you wait a certain (though still short) amount of time between key presses it goes to the next starting letter rather than add to the existing letter/letters. That might work for everyone (or at least most people, you can't please everyone).

in reply to:  6 comment:11 by historic_bruno, 11 years ago

Replying to wraitii:

Some comments on said patch:
-It doesn't handle lists since I'm not too sure what lists actually are. Code should be fairly easily transposable if needed.

The old map selection in match setup was a list. I don't know if we actually have a list anymore, but we might in the future (with UI redesign). Also the selection part of the dropdown is a list.

Replying to zoot:

Right. I guess what I am asking is why not just use the standard behavior of iterating?

Not sure I agree that's standard behavior. At least on the web, I often see dropdowns behave somewhat as wraitii describes - actually more like feneur in his comment, a delay after the last letter pressed. Our in-game UI doesn't make any effort to conform to native UI behavior, as far as I know, so let's just decide what is most usable in the context of 0 A.D. and go with that.

I have to say, typing in words sounds more useful, because there's always arrow keys if you want to iterate through the list (A + [down arrow] is the same as pressing A several times would be under your proposal). But we also have someone focusing on UI design now (Pureon) so we could present both designs and ask for his preference.

Last edited 11 years ago by historic_bruno (previous) (diff)

comment:12 by Pureon, 11 years ago

I agree with feneur's suggestion. That's my preferred functionality and it would work as expected for most users due to the suggested key press delay.

comment:13 by Pureon, 11 years ago

Keywords: design added

comment:14 by wraitii, 11 years ago

In 13556:

Make water specular more visible and fixes a few cases where it would actually hardly appear when it should.
Adds the ability to access an element in a dropdown box by typing the first letters (Refs #1532).

in reply to:  14 comment:15 by historic_bruno, 11 years ago

Replying to wraitii:

In 13556:

Make water specular more visible and fixes a few cases where it would actually hardly appear when it should.
Adds the ability to access an element in a dropdown box by typing the first letters (Refs #1532).

Should this play sound_selected when a text shortcut changes the active selection?

Note: See TracTickets for help on using tickets.