Solved

Text in graphics mode.

Posted on 1998-11-30
7
1,121 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now