Coded
Topic Author
Posts: 26
Joined: 23 Jul 2022, 21:46

button keyboard opening

19 Nov 2022, 18:05

I'm having a bizarre bug with buttons, when I keep pressing several keys "space" numbers I end up pressing the button as if I had pressed "enter" but I'm already using this function in each button: KeyboardNavigation.AcceptsReturn="False", is there any other function to be used that avoids this kind of problem?

i am using neosis 3.1.5 c++
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: button keyboard opening

23 Nov 2022, 12:28

Hello,

The space bar is the default action key used to press a focused Button.
The return key can also be used to press a focused Button if you set KeyboardNavigation::AcceptsReturn to true. But setting it to false, only disables the return key, not the space key.
If you want to disable the space bar default behavior you have to handle the PreviewKeyDown for the button and mark it as handled for the space bar key. This can be done using a custom behavior assigned to your button (with a style if you want to reuse it).
 
Coded
Topic Author
Posts: 26
Joined: 23 Jul 2022, 21:46

Re: button keyboard opening

23 Nov 2022, 16:02

ok thanks for the reply, maybe a suggestion for the future to also have the option to deactivate the same space you can do with return, thanks for your attention!

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 97 guests