Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dropdown List

Discussion in '2D' started by TheWebExpert, Sep 10, 2019.

  1. TheWebExpert

    TheWebExpert

    Joined:
    Apr 14, 2015
    Posts:
    198
    This is PROBABLY very simple, but...

    I have a screen form (similar to what you'd see in MS Access). You can use the tab key to move from field to field. When you get to the dropdown and push spacebar, the list drops down. However, it doesn't have the focus - which I need it to have, so that when you use the arrow keys, it will cycle through the list; I'm assuming that enter will "close" the dropdown.

    The other problem is, if I've pressed the spacebar and then hit tab, I want the dropdown to close automatically. I haven't been able to find out how to do this anywhere.

    I'm selecting the object thusly:
    GameObject.Find(Fields[Field]).GetComponent<Dropdown>().Select();

    ...and it IS selected (hence, the action when you press the spacebar). However, it isn't "active," the way it would be if you clicked it with the mouse.

    Can anyone help??
     
  2. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807