BrandonReinhart
Topic Author
Posts: 29
Joined: 10 Jan 2025, 17:02

Unity: Tab / Spacebar Interaction

24 Apr 2025, 23:22

Is it possible in some simple way to disable the ability to focus on buttons, etc? I.e. tab will select all sorts of controls and space will trigger buttons. If I write an explicit text entry control than, sure, I want to focus and capture input, but by default almost no controls should do this in a game. It's the source of quite a number of bugs.
 
BrandonReinhart
Topic Author
Posts: 29
Joined: 10 Jan 2025, 17:02

Re: Unity: Tab / Spacebar Interaction

24 Apr 2025, 23:35

Ah, okay. I think I have this figured out.
    <Style TargetType="{x:Type RadioButton}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="IsTabStop" Value="False" />
    </Style>
    
                <Style x:Key="SpeedRadioButtonStyle" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource {x:Type RadioButton}}">
etc
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Unity: Tab / Spacebar Interaction

28 Apr 2025, 21:01

Yes, any Control by default has its Focusable property set to True, but you can change it as you indicated.
If you want ot stop any interaction with a control you can disable it by setting the IsEnabled property to False.

Who is online

Users browsing this forum: Bing [Bot] and 2 guests