Solved

Text in graphics mode.

Posted on 1998-11-30
7
1,126 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
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 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

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

730 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