Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

getting input without the enter key

Posted on 2001-09-10
8
Medium Priority
?
244 Views
Last Modified: 2010-04-16
An example

if i have a value and i would like to use the plus key to increase the value and the minus key to decrease the value, and i would not like to press + follow by enter or - follow by enter, is there any way where i can interactively see the my value on screen with the press of + and - key ??.
 Notes - normal screen , not using turbo vision or the menu interface pls.
0
Comment
Question by:darentan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 6

Expert Comment

by:My name is Mud
ID: 6473283
You can use a loop of some kind, like while or repeat on the main program, and exit on esc, for example...

Var
  A: Integer;
  Key: Char;

Begin
  A:=0;
  Repeat
    If keypressed Then
      begin
        Key:=RedKey;
        If Key = #0 Then  {Take off the first char of the control code key}
          Key:=RedKey;
      end;
    Case Key Of
      "+":
        Begin
          Inc(A);       {Increment A}
          Key:=#0;   {Make Key other than what it is, to avoid repeat without pressing a key}
        End;
      "-":
        Begin
          Dec(A);     {Decrement A}
          Key:=#0;   {Same as above}
        End;
    End;
  Until key = #27 {Exit on "esc" key}
End.
0
 
LVL 6

Expert Comment

by:My name is Mud
ID: 6473288
BTW if you receive some help on this question http://www.experts-exchange.com/jsp/qShow.jsp?ta=pascal&qid=11303078 or if you did not, you should awarded or delete it...
0
 
LVL 6

Accepted Solution

by:
My name is Mud earned 200 total points
ID: 6473306
Oh forgot to tell you that with a ReadKey, you don't need to press the Enter key, that function returns the KeyCode of the key a user has pressed... for example...


If the user press "+" on the NumPad it will return a keyCode of 43, "-" 45...

If a user press F1 it will return... hey why don't you try it... use it with "shift", "Ctrl" and "Alt" and any other combinations...

****************************************************************
Program Test_Key_Pressed;
Uses
  Crt;
Var
  Key: Char;

Begin
  Repeat
    If KeyPressed Then
      Begin
        Key:=ReadKey;
        If Key = #0 Then
          Begin
            Write(0:3);
            Key:=ReadKey;
          End;
        WriteLn(Byte(Key):3,Char(Key):3);
      End
  Until Key = #27;
End.
****************************************************************
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:darentan
ID: 6473308
but if as u show above, the first key read (readln) aready require a enter key.The keypressed would requir a readln input, errr...
0
 

Author Comment

by:darentan
ID: 6473311
Sorry about that, i did not refresh my screen as it show the first comment, i trying it out now
0
 

Author Comment

by:darentan
ID: 6473328
Sorry about that, i did not refresh my screen as it show the first comment, i trying it out now
0
 

Author Comment

by:darentan
ID: 6473329
Sorry about that, i did not refresh my screen as it show the first comment, i trying it out now
0
 

Author Comment

by:darentan
ID: 6473438
forgot about the readkey :?


thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question