examinekeyboard needs open(window)screen ?

Windows specific forum
sartic
Enthusiast
Enthusiast
Posts: 143
Joined: Thu Aug 26, 2010 8:26 am

examinekeyboard needs open(window)screen ?

Post by sartic »

If Not(InitKeyboard())
End 99
EndIf
If ExamineKeyboard()
If KeyboardReleased(#PB_Key_Pause) Or KeyboardReleased(#PB_Key_Scroll)
Break
EndIf
EndIf

there is no explanation in help.
strange thing it works compiled on my system but it gives error on run.

ps: in help file there is no result for examinekeyboard so there is no need for if in this program?
Registered user of PB (on Linux Mint 21.1 & Win 10 64bit)
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: examinekeyboard needs open(window)screen ?

Post by netmaestro »

The keyboard library docs do say it depends on DirectX but they should really go on to say a screen needs to be open as well, that seems to be a deficiency in the help file.
BERESHEIT
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: examinekeyboard needs open(window)screen ?

Post by luis »

Isn't reported by the debugger ?

"OpenScreen() or OpenWindowedScreen() must be called before using any Keyboard commands."

Anyway a mention in the manual wouldn't hurt.
"Have you tried turning it off and on again ?"
sartic
Enthusiast
Enthusiast
Posts: 143
Joined: Thu Aug 26, 2010 8:26 am

Re: examinekeyboard needs open(window)screen ?

Post by sartic »

yes, it is. but works on my system, crashing on other without openscreen (it depends on initsprite etc...)
i will investigate how to check for key input without dx.
Registered user of PB (on Linux Mint 21.1 & Win 10 64bit)
Post Reply