Help needed! 
Author Message
 Help needed!

While the example in Prof. Salmi's FAQ is helpful, I tried something
very similar, and it interferes with my 'readln(cmd);'. This is what i
am trying to get around.
Quote:


> >I have a program that is causing me some difficulty. What I want it to
> >do is read a command from the command line, and execute it, but if the
> >up cursor or F3 key is pressed, to show the previous command typed. Here
> >is a sample of the code so far (ask me if u want the whole program):

> >procedure com_line;
> >var oldcmd: string;
> >begin
> > repeat
> >  write(prmpt);
> >  readln(cmd);
> >  oldcmd:=cmd;
> >  if cmd='' then com_line;
> >  chkcmd;
> > until cmd='/C exit';
> >end;

> >I need to ammend this somehow to check to see if the up cursor or F3 is
> >pressed. Can anyone help? Thanks in advance

> I assume you want to know how to detect if F3 or CursorUp has
> been pressed. This must be one of the most frequently asked FAQs,
> and it is covered in detail in FAQPAS1.TXT, posted in this newsgroup
> every week by Prof. T. Salmi. Look for "Q3".

> KlausL

> P.S. Try and be a little more specific in your subject line.
> "Help needed" is about as meaningless as it gets. If you
> did not need help you probably would not raise an item.



Wed, 18 Jun 1902 08:00:00 GMT  
 Help needed!

Quote:
>While the example in Prof. Salmi's FAQ is helpful, I tried something
>very similar, and it interferes with my 'readln(cmd);'. This is what
i
>am trying to get around.
>...
>> >procedure com_line;
>> >var oldcmd: string;
>> >begin
>> > repeat
>> >  write(prmpt);
>> >  readln(cmd);
>> >  oldcmd:=cmd;
>> >  if cmd='' then com_line;
>> >  chkcmd;
>> > until cmd='/C exit';
>> >end;

You are not showing where you test for F3 or up cursor.  If you do
that after "oldcmd:=cmd;", you are late, oldcmd has vanished already.

Also you does have only one level of oldcmd.

And then, with cmd being '' you call the procedure itself recursively.
You are probably making a mess in there.  And since oldcmd is not a
static variable, it is not preserved from one call to another.

--
Raimo Suonio, Helsinki, Finland
http://www.dlc.fi/%7Eexp-1/suonio/
Oikeinkirjoitusohjeita news- ja web-kirjoittajille:
http://www.dlc.fi/%7Eexp-1/oikeinkirjoitus.html



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Emergency Help Needed: C2pascal program needed

2. HELP - Need help on TDBLookUpList

3. Help - Need Help in Drivers!

4. Help, need help for schedule program

5. Help needed with help

6. HELP: Need quick help with procedures!!

7. Basic help needed again.

8. **** HELP **** needed with a paramatized SQL QUery in Delphi 2

9. HELP needed on accessing network files

10. TDataBase and MSAcces - Help needed

11. Help needed, Syncronization, MS-Access 7.0

 

 
Powered by phpBB® Forum Software