Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!quiche!bart!einstein From: einstein@quiche.cs.mcgill.ca (Michael CHOWET) Newsgroups: comp.lang.pascal Subject: Re: Fields on the screen for a DataBase Summary: Using the Goto, have an array of screen locations & a pointer to current Message-ID: <95@bart.cs.mcgill.ca> Date: 4 Dec 90 20:09:53 GMT References: <259.275a4a92@zodiac.rutgers.edu> Organization: SOCS - Mcgill University, Montreal, Canada Lines: 48 In article <259.275a4a92@zodiac.rutgers.edu> mshah@zodiac.rutgers.edu writes: >I need to know how I can use the direction keys to identify different fields. >[etc..] I did something similar; I did a menu-driven security program for my home PC, and the choices available through the managing utility had me up against this same thing. ( I WAS going to do exactly what you are looking for, but my parents decided that their company wasn't quite ready to computerize their inventory/accounting/invoicing. But enough of that... About the fields... First, you need to know how to interpret the arrow keys. I'll assume you know how, if not, just post back. Next, I suggest you keep an array, [ 0..Number_Of_Fields-1 ] of Record. This record will store your X and Y coordintes (two integers, or bytes if memory's tight). Now, before you hide under your bed at the sight of the upcoming word, give me chance. Now, keep a pointer (Arrrrrrgh! The P word! :-) to where you are. (Which field you're at). This would simply be an integer, not the built in pointer type. Say you're at the first field, your pointer would hold 0. Hit the down-arrow, and the pointer jumps to 1, and you call GotoXY with the parameters stored in your record (arr[pointer].X or .Y). Now comes something a little tricky for beginners to Pascal. How do you jump from the last field to the first? You could use an IF, but that isn't elegant, and would probably go slower (but hey, who'd notice on a Cray, anyways?? :-). Instead, have you incrementer make use of a mod statement. The use would be something like Point := ( Point + 1 ) Mod Number_Of_Fields ; You will probably need an if for a decrement, though. >P.S.> I am a beginner at programmer and I don't know how to use pointers. Now then, that wasn't so bad, was it? -- ============================================================================== Today's message was brought to you by the letter 'S', the number 6, and =====> Einstein@cs.mcgill.ca <==== =====> Mike CHOWET | McGill CSUS VP External <===== Post back soon, now y'hear... ============================================================================== Brought to you by Super Global Mega Corp .com