Page 1 of 1
Posted: Mon Jun 10, 2002 2:12 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
Does anyone remember/know what API commands to use to check for pressing an up or down arrow?
I'd rather not use the PB keyboard function because that requires an up-to-date DirectX installed and a lot of people who test my programs do not have that and of course it crashes.
/me falls out of the chair asleep. (IRC talk)
Thanks to anyone who remembers:)
Fangles
Posted: Mon Jun 10, 2002 2:27 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> Does anyone remember/know what API commands to use to check for pressing an up or down arrow?
Code: Select all
GetAsyncKeyState_(#VK_UP) ; Clear up key buffer.
GetAsyncKeyState_(#VK_DOWN) ; Clear down key buffer.
;
; And to check their state during runtime:
If GetAsyncKeyState_(#VK_UP)=-32767 ; Up arrow pressed.
If GetAsyncKeyState_(#VK_DOWN)=-32767 ; Down arrow pressed.
PB - Registered PureBasic Coder
Edited by - PB on 11 June 2002 01:55:17
Posted: Mon Jun 10, 2002 3:26 pm
by BackupUser
Restored from previous forum. Originally posted by fred.
Why not using AddKeyboardShortcut(Window, #PB_Shortcut_Up) ?
Fred - AlphaSND
Posted: Mon Jun 10, 2002 4:17 pm
by BackupUser
Restored from previous forum. Originally posted by fweil.
I tested it and it is the right way to do it now ... good and useful.
Francois Weil
14, rue Douer
F64100 Bayonne
Posted: Mon Jun 10, 2002 6:34 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> I tested it and it is the right way to do it now
Using the API is not a "wrong" way, you know.
PB - Registered PureBasic Coder
Posted: Tue Jun 11, 2002 12:03 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
Why not using AddKeyboardShortcut(Window, #PB_Shortcut_Up) ?
Fred - AlphaSND
A. I don't know where to put it (no example).
B. I don't know the syntax to check it.
I need to generate an up and down arrow event in a ListIconGadget so that I can go to some code. Where do I put that above code, how do I check it??
Fangles
Posted: Tue Jun 11, 2002 12:15 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
> Does anyone remember/know what API commands to use to check for pressing an up or down arrow?
Code: Select all
GetAsyncKeyState_(#VK_UPARROW) ; Clear up key buffer.
GetAsyncKeyState_(#VK_DOWNARROW) ; Clear down key buffer.
;
; And to check their state during runtime:
If GetAsyncKeyState_(#VK_UPARROW)=-32767 ; Up arrow pressed.
If GetAsyncKeyState_(#VK_DOWNARROW)=-32767 ; Down arrow pressed.
PB - Registered PureBasic Coder
Thanks PB, but I get "Constant not found" for those two.
Fangles
Posted: Tue Jun 11, 2002 12:54 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> Thanks PB, but I get "Constant not found" for those two.
Sorry, they're meant to be #VK_UP and #VK_DOWN (I typed them from memory and
while half-asleep). I've fixed my example above to reflect this. BTW, all
these constants are found in the Win32API.doc file, if you have it. If not,
it's here (143k):
http://www.mvps.org/vb/code/Win32api.zip
PB - Registered PureBasic Coder
Posted: Tue Jun 11, 2002 1:42 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
> Thanks PB, but I get "Constant not found" for those two.
Sorry, they're meant to be #VK_UP and #VK_DOWN (I typed them from memory and
while half-asleep). I've fixed my example above to reflect this. BTW, all
these constants are found in the Win32API.doc file, if you have it. If not,
it's here (143k):
http://www.mvps.org/vb/code/Win32api.zip
PB - Registered PureBasic Coder
Thanks PB, works like a duck's bottom in water

:)
Fangles