home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!wtrlnd!contrast!postmaster
- From: berend@contrast.wlink.nl (Berend de Boer)
- Newsgroups: comp.lang.pascal
- Subject: BP7 and Turbovision Questions
- Message-ID: <725720113.AA00969@contrast.wlink.nl>
- Date: Wed, 30 Dec 1992 09:14:20
- Sender: postmaster@contrast.wlink.nl
- Lines: 74
-
- Kristen Anne Pribis wrote in a message to All:
-
- KAP> The last time I programmed in Pascal I used TP 4.0. I
- KAP> recently received BP 7.0 and am absolutely amazed at its
- KAP> capabilities. I am slowly working my way through Turbo
- KAP> Vision, and have a question. I would like a data entry
- KAP> window to be opened as soon as the program starts, asking
- KAP> for the user to swipe a
- KAP> credit card through a card reader (simulates keyboard
- KAP> input). If the card is swiped through (the string ends
- KAP> with '?'), I want to run a routine without the user having
- KAP> to hit enter or any key. If the user presses F3, instead
- KAP> of swiping the card, I would like to run another routine
- KAP> for manual entry.
-
- KAP> 1) Where should I place the first window procedure? In the
- KAP> Application Init constructor? Or can I simulate an event
- KAP> and pass the simulated event (such as cmOpenInitWindow or
- KAP> something) to the HandleEvent procedure?
-
- I would do it so:
-
- begin
- MyApp.Init;
- {* set up a dialog box and execute it *}
- MyApp.Run;
- MyApp.Done;
- end.
-
- Not necessary, but it's the easiest way.
-
- KAP> 2) How can I scan a data entry field for a '?' and then end
- KAP> data entry once it receives the '?'?
-
- Popup a dialogbox (because it should be modal). Override the HandleEvent
- of this Dialog box. Pseudo code (not bullet proof, just to give you an
- idea). I have done it a bit differently. The user doesn't even have to
- press F3. If a ? is encountered as the first char, card input is assumed
- else keyboard input. Keyboard input has to be ended with pressing Enter,
- card input not.
-
-
- procedure TMyDialog.HandleEvent(var Event : TEvent);
- begin
- if Event.What and evKeyBoard <> 0 then begin
- if key is the first time '?' and it is the first input
- then assume card input.
- if key is the 2nd time '?' and input was card input
- then issue a cmOK command
- end;
- TDialog.HandleEvent;
- end;
-
- Set up a dialog with a standard input line and a standard OK button. Get
- the inputted value (either keyboard or card) with the GetData method.
-
- KAP> 3) If I'm scanning for a '?', can I still capture an F3 to
- KAP> run a different routing?
-
- See, above.
-
- KAP> Replies can be posted here, but preferably mailed to me at
- KAP> pribik@rpi.edu. Thanks in advance, and to all of those who
- KAP> helped me with my async communications questions.
-
- I prefer replying in this area so others can comment.
-
-
- Groetjes,
-
- Berend. (-:
- fido: 2:281/527.23
- email: berend@contrast.wlink.nl
-
-