home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / n_calc / ncalc.txt < prev    next >
Text File  |  1992-03-26  |  2KB  |  46 lines

  1. NCALC - Demonstrate Keyboard and Control handling
  2.  
  3. NCALC is a simple modification to the calc that comes as a demo with 
  4. Visual Basic. The only enhancements I have made is to allow keyboard entry
  5. and to have the keys depress on each keystroke as if pressed with a mouse.
  6.  
  7. The technique for keyboard handling involves routing each control to a 
  8. common keyboard handler by setting the KeyDown and KeyUp events 
  9. for each control to pass through ProcessKeyDown and ProcessKeyUp.
  10.  
  11. In the common KeyDown handler (ProcessKeyDown) there is a SetFocus command
  12. that is followed by a library call to getFocus(). 
  13. Getfocus returns the handle to the control that currently has the focus. 
  14. The handle is then passed to the sendMessage() library call to set 
  15. the state of the button to down. This is reversed in the common KeyUp 
  16. handler (ProcessKeyUp).
  17.  
  18. Note that in ProcessKeyUp the focus is set to the equals key. This is to allow
  19. enter to work the same as equals. Apparently you cannot intercept the 
  20. enter key with a keydown event, instead it acts on the control with the focus
  21. as if you had clicked on it. If anyone has a 'simple' way to deal with this,
  22. Let me know. (I have a complex way already!).
  23.  
  24. Look in the global module for definitions of the library routines.
  25.  
  26. This program was written in as straight forward a manner as possible. Many
  27. improvements and additions are possible. Have fun!
  28.  
  29. This program is copyright by Microsoft and being distributed in accordance
  30. with the release granted in the (common) (declarations),
  31. any extensions made by myself, Marcus Smaby, are released to the 
  32. public domain. 3/25/92
  33.  
  34. As an experienced windows and unix programmer, I am available on a work-for-hire basis
  35. for any project that can be performed over CIS, modem and Fax. I have experience
  36. and have taught; SmallTalk V/Win, Turbo Pascal for Windows, C++ for Windows,
  37. Superbase 4, Progress (Unix) and Visual Basic. If you would like to
  38. talk to  me regarding custom programming contact me at my CIS ID.
  39.  
  40.  
  41. Marcus Smaby
  42. (72571,3126)
  43.  
  44.  
  45.  
  46.