Keyboard interaction with OptionGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Keyboard interaction with OptionGadget

Post by blueznl »

If a user doesn't have a mouse, how would he / she interact with multiple OptionGadget's?

Code: Select all

OpenWindow(1,10,10,200,200,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OptionGadget(1,10,10,50,20,"Option 1")
OptionGadget(2,10,30,50,20,"Option 2")
OptionGadget(3,10,50,50,20,"Option 3")
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Keyboard interaction with OptionGadget

Post by Little John »

//edit:

I simplified and improved the code, and moved it to the "Tricks 'n' Tips" section.
Last edited by Little John on Tue Jun 29, 2021 9:30 pm, edited 2 times in total.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Keyboard interaction with OptionGadget

Post by blueznl »

Ouch. No native support of the tab or left / right keys? That's bad...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Keyboard interaction with OptionGadget

Post by Little John »

blueznl wrote:Ouch. No native support of the tab or left / right keys? That's bad...
Yes, unfortunately PB has no built-in support of up/down or left/right keys for changing the selected option within a group.

The TAB key shouldn't do that, but pressing TAB should leave the whole option group (remembering which option was selected), and activate another control.
I've extended my above code example, so that it demonstrates this behaviour.
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Keyboard interaction with OptionGadget

Post by Little John »

[u]Announcement for PureBasic 5.45 LTS Beta 1[/u] wrote:optionGadget on Windows now support keyboard
Image
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Keyboard interaction with OptionGadget

Post by blueznl »

Mmmm. On 5.60 x64 I can tab through the options, until one of them is selected (with the space bar), then it no longer works... Bug? Or is the LTS ahead of the non-LTS this time? :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Keyboard interaction with OptionGadget

Post by Little John »

blueznl wrote:Or is the LTS ahead of the non-LTS this time? :-)
The newest final LTS version (which is PB 5.44) is not ahead of the newest final non-LTS version (which is PB 5.60).

However, I was talking about a change in the brand new version PB 5.45 LTS Beta 1, which is just a few days old.
In the post to which I've linked in my previous message, it reads:
[...] all the changes will be transfered on the 5.61 version.
In other words, the regarding new changes have not yet been implemented in version 5.60. :-)

BTW: It seems to be fixed now on Linux, too.
Post Reply