Solved

Text in graphics mode.

Posted on 1998-11-30
7
1,124 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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…

831 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