Solved

Text in graphics mode.

Posted on 1998-11-30
7
1,127 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
[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
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
Independent Software Vendors: 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 100 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

Technology Partners: 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!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

705 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