[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Text in graphics mode.

Posted on 1998-11-30
7
Medium Priority
?
1,132 Views
Last Modified: 2008-03-17
Is there any way of letting the user enter text (in Borland C++)when in graphics mode? ( I know there is a command called "outtext" which allows you to dispaly text in graphics mode.Is there anything which will allow the user to enter the text in graphics mode.It is a  DOS based application.)
0
Comment
Question by:st6
7 Comments
 

Author Comment

by:st6
ID: 1178885
Edited text of question
0
 

Author Comment

by:st6
ID: 1178886
Edited text of question
0
 

Expert Comment

by:Mithander
ID: 1178887
I think you can use the getch() command.  I don't use Borland though.  but it would be something like this.

char c;
char buffer[BUF_SIZE];
int i;

i=0;
memset(buffer,0,BUF_SIZE);
do
{
  c = getch();
  if(c!=0)
  {
    outtext(buffer,x,y);
    buffer[i++]=c;
  }
}
while(c!='\n');
buffer[i]=0;

I don't have a compile handy to check it.  Also I use g++ so I don't know if borland will take it.  But hopefully it's a start.
 

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:Mithander
ID: 1178888
Sorry, I forgot.  You would also have to handle Backspace as well.  something like this:
if(c=='\b')
  buffer[i--]=0;

I'm not sure what the character code for backspace is though.  I think \b is beep.
0
 
LVL 1

Expert Comment

by:cph
ID: 1178889
Have you try outtextxy, it's similar to outtext but you specify where you want to display the text on the screen. (include graphics.h file)

CpH
0
 
LVL 2

Accepted Solution

by:
wyy_cq earned 200 total points
ID: 1178890
you need to set the cursor position .
the left thing is just like in the text mode.
getch(),getc(),gets()...... all can be effect.

0
 

Author Comment

by:st6
ID: 1178891
Even though the information is useful,I would have preffered some  more information, like how to set the cursor position as well.I just need to display a cursor where ever the user clicks his mouse, and after that he must be able to enter the text until he presses enter.Can anyone help me?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

830 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