PRODUCT : Borland C++ NUMBER : 1170 VERSION : 3.1 OS : DOS DATE : October 22, 1993 PAGE : 1/3 TITLE : Solving keyboard conflicts in the IDE. QUESTION: ======== Sometimes when using the arrow keys in the IDE I get strange effects, such as the shift key getting stuck on (so that everything comes out in capitals) or perhaps numbers come out sometimes. I see things like going through text with an arrow key and then sometimes it starts to highlight everything. Why is this happening and what can I do about it? ANSWER: ======= When you use the computer's keyboard, 1 or 2 or 4 interrupts are generated when the key goes down, and also when the key goes up. The machine tries to figure out from the scan codes what key was hit, and what action to take on it. Upon occasion, for various reasons, some of these interrupts may not be responded to and some of the scan codes may be lost. If some of the scan codes are lost, an arrow-key keystroke may look to the machine like a number key, or like a shift key going down (and not coming back up). So when the machine sees the shift key going down, it assumes you are holding it down, so your arrow looks like a shift-arrow and the block should be highlighted. Or you may type in capitals when you did not intend to. QUESTION: ========= So why are the interrupts not being responded to? ANSWER: ======= Because one scan code has not been dealt with by the time the next one comes along. The IDE traps the interrupt and it has a fair amount of processing to do; other TSR's that also deal with the keyboard (anything that responds to a hotkey or changes the way the keyboard works, like DOSKEY) slow down the keyboard response. Your expanded memory manager, such as EMM386 or QEMM, also has a role to play; the IDE has to switch modes from PRODUCT : Borland C++ NUMBER : 1170 VERSION : 3.1 OS : DOS DATE : October 22, 1993 PAGE : 2/3 TITLE : Solving keyboard conflicts in the IDE. protected to real mode to handle the key and it must do this through the expanded memory manager if the latter is present. The number of interrupts coming in also makes a difference. The arrow keys usually generate 4 interrupts per keystroke (2 down, 2 up) but when NUMLOCK is on, they generate 8 interrupts per keystroke. So one solution is to take NUMLOCK off, or simply to reduce the repeat rate. Your hardware also makes a difference. Your keyboard should not be sending more keystrokes until the previous one has been acknowledged but unfortunately not all keyboards behave that way. QUESTION: ========= Just tell me what I have to do. ANSWER: Short term solutions: > When the shift state gets toggled, just tap the shift key to reset it. > Turn off NUMLOCK. > Use the keypad arrow keys instead of the extended arrow keys. > Use the /IA and /U8 (Ignore A20 and Unusual 8042) options with QEMM. > Take out your expanded memory manager entirely. > Take out TSR's that use hotkeys or change the behavior of the keyboard, such as DOSKEY. (4DOS or NDOS is recommended if you like DOSKEY's features.) > Slow down your keyboard autorepeat (often settable in CMOS BIOS options) or take out a utility that speeds up the keyboard repeat. Longer-term solutions: > Try a different keyboard. Borrow a friend's, and see if you get better results. If that helps, consider upgrading to that style of keyboard. > Try a different BIOS (BIOS upgrades run less than $50, and may give you additional features) or change the keyboard BIOS. > Try using the DOS TSR KEYB. From the dos directory, type "KEYB US,,KEYBOARD.SYS". This will install a PRODUCT : Borland C++ NUMBER : 1170 VERSION : 3.1 OS : DOS DATE : October 22, 1993 PAGE : 3/3 TITLE : Solving keyboard conflicts in the IDE. software keyboard handler that will be slightly slower, but may work better with the compiler. DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.