Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GUI and keyboard-input

Discussion in 'Immediate Mode GUI (IMGUI)' started by Harry1960, Jan 4, 2008.

  1. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Is it possible to control the gui system with the keyboard? Let's assume that we have a GUI.Box and 2 GUI.Buttons. The tab-key activates the button's and enter/return simulates a mouse-click?
     
  2. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    Not yet. Basically, we have the tab-navigation, but I need to do a bunch of code to make all the buttons / sliders / whatnot react to keyboard input.
     
  3. hai_ok

    hai_ok

    Joined:
    Jun 20, 2007
    Posts:
    193
    well not directly, but couldn't you count the number of times the tab key was released since the gui was shown, and "listen" for the enter key?

    just spitballing here.
     
  4. Brian-Kehrer

    Brian-Kehrer

    Joined:
    Nov 7, 2006
    Posts:
    411
    it shouldn't be too hard to implement yourself- a clarification of whats suggested above:

    Keep IDs of each tab-button, detect when tab is pushed, and change the id accordingly

    then, on enter, activate id = x;

    You need to make your GUI more of a bridge structure, but that tends to be handy in Unity anyway.