Holding Buttons in DOS
- Posted by "Cuny, David" <David.Cuny at DSS.CA.GOV> Oct 07, 1998
- 451 views
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01BDF236.ADE63846 charset="iso-8859-1" I'm trying to emulate Win32-style key events in DOS. I need a *different* way of reading the keyboard. Here's a typical problem with the way the keyboard is currently handled. I'm trying to emulate Win32 button behavior in DOS. Pressing down the spacebar when the focus is on the button toggles the button, and it is held down until the space bar is released. You can tab off the button, even if it is pressed, and not have it selected. When I try to duplicate this in DOS, holding down a button triggers the auto repeat on the key, and I end up getting a stream of keys. Even if I wait for -1 event on get_key() to emulate a key up/down type behavior, the auto repeat clicks away - very irritating. Win32 splits a button press into three seperate events: key down, key up, and key press. For example, if you hold down the Space bar, you might get the following events queued: Space key down Space key pressed Space key pressed Space key pressed Space key pressed Space key up How do I query the keyboard to get this information? I've seen this done in Allegro, but they replace the DOS interrupt with one of their own, and I'm not big on writing interrupts myself... Thanks! -- David Cuny ------_=_NextPart_001_01BDF236.ADE63846 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2232.0"> <TITLE>Holding Buttons in DOS</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2>I'm trying to emulate Win32-style key events in DOS. = I need a *different* way of reading the keyboard. </FONT> </P> <P><FONT SIZE=3D2>Here's a typical problem with the way the keyboard is = currently handled. I'm trying to emulate Win32 button behavior in DOS. = Pressing down the spacebar when the focus is on the button toggles the = button, and it is held down until the space bar is released. You can = tab off the button, even if it is pressed, and not have it = selected.</FONT></P> <P><FONT SIZE=3D2>When I try to duplicate this in DOS, holding down a = button triggers the auto repeat on the key, and I end up getting a = stream of keys. Even if I wait for -1 event on get_key() to emulate a = key up/down type behavior, the auto repeat clicks away - very = irritating.</FONT></P> <P><FONT SIZE=3D2>Win32 splits a button press into three seperate = events: key down, key up, and key press. For example, if you hold down = the Space bar, you might get the following events queued:</FONT></P> <P> <FONT SIZE=3D2>Space key = down</FONT> <BR> <FONT SIZE=3D2>Space key = pressed</FONT> <BR> <FONT SIZE=3D2>Space key = pressed</FONT> <BR> <FONT SIZE=3D2>Space key = pressed</FONT> <BR> <FONT SIZE=3D2>Space key = pressed</FONT> <BR> <FONT SIZE=3D2>Space key = up</FONT> </P> <P><FONT SIZE=3D2>How do I query the keyboard to get this information? = I've seen this done in Allegro, but they replace the DOS interrupt with = one of their own, and I'm not big on writing interrupts = myself...</FONT></P> <P><FONT SIZE=3D2>Thanks!</FONT> </P> <P><FONT SIZE=3D2>-- David Cuny</FONT> </P> </HTML> ------_=_NextPart_001_01BDF236.ADE63846--