home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pascal / 7787 < prev    next >
Encoding:
Internet Message Format  |  1993-01-01  |  2.8 KB

  1. Path: sparky!uunet!mcsun!sun4nl!wtrlnd!contrast!postmaster
  2. From: berend@contrast.wlink.nl (Berend de Boer)
  3. Newsgroups: comp.lang.pascal
  4. Subject: BP7 and Turbovision Questions
  5. Message-ID: <725720113.AA00969@contrast.wlink.nl>
  6. Date: Wed, 30 Dec 1992 09:14:20
  7. Sender: postmaster@contrast.wlink.nl
  8. Lines: 74
  9.  
  10. Kristen Anne Pribis wrote in a message to All:
  11.  
  12.  KAP> The last time I programmed in Pascal I used TP 4.0.  I
  13.  KAP> recently  received BP 7.0 and am absolutely amazed at its
  14.  KAP> capabilities.   I am slowly working my way through Turbo
  15.  KAP> Vision, and have a  question.  I would like a data entry
  16.  KAP> window to be opened as  soon as the program starts, asking
  17.  KAP> for the user to swipe a 
  18.  KAP> credit card through a card reader (simulates keyboard
  19.  KAP> input).   If the card is swiped through (the string ends
  20.  KAP> with '?'), I  want to run a routine without the user having
  21.  KAP> to hit enter or  any key.  If the user presses F3, instead
  22.  KAP> of swiping the card,  I would like to run another routine
  23.  KAP> for manual entry.
  24.  
  25.  KAP> 1) Where should I place the first window procedure?  In the 
  26.  KAP> Application Init constructor?  Or can I simulate an event
  27.  KAP> and pass the simulated event (such as cmOpenInitWindow or 
  28.  KAP> something) to the HandleEvent procedure?
  29.  
  30. I would do it so:
  31.  
  32. begin
  33.   MyApp.Init;
  34.   {* set up a dialog box and execute it *}
  35.   MyApp.Run;
  36.   MyApp.Done;
  37. end.
  38.  
  39. Not necessary, but it's the easiest way.
  40.  
  41.  KAP> 2) How can I scan a data entry field for a '?' and then end
  42.  KAP> data  entry once it receives the '?'?
  43.  
  44. Popup a dialogbox (because it should be modal). Override the HandleEvent
  45. of this Dialog box. Pseudo code (not bullet proof, just to give you an
  46. idea). I have done it a bit differently. The user doesn't even have to
  47. press F3. If a ? is encountered as the first char, card input is assumed
  48. else keyboard input. Keyboard input has to be ended with pressing Enter,
  49. card input not.
  50.  
  51.  
  52. procedure TMyDialog.HandleEvent(var Event : TEvent);
  53. begin
  54.   if Event.What and evKeyBoard <> 0 then  begin
  55.     if key is the first time '?' and it is the first input
  56.     then  assume card input.
  57.     if key is the 2nd time '?' and input was card input
  58.     then issue a cmOK command
  59.   end;
  60.   TDialog.HandleEvent;
  61. end;
  62.  
  63. Set up a dialog with a standard input line and a standard OK button. Get
  64. the inputted value (either keyboard or card) with the GetData method.
  65.  
  66.  KAP> 3) If I'm scanning for a '?', can I still capture an F3 to
  67.  KAP> run a  different routing?
  68.  
  69. See, above.
  70.  
  71.  KAP> Replies can be posted here, but preferably mailed to me at
  72.  KAP> pribik@rpi.edu.  Thanks in advance, and to all of those who
  73.  KAP> helped me with my async communications questions.
  74.  
  75. I prefer replying in this area so others can comment.
  76.  
  77.  
  78. Groetjes,
  79.  
  80. Berend. (-:
  81. fido: 2:281/527.23
  82. email: berend@contrast.wlink.nl
  83.  
  84.