How can I read a mouse click on some character that is printed? (I can get its position in a COORD)... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I read a mouse click on some character that is printed? (I can get its position in a COORD)...

I have an Airline Reservation Program. Now, to book the seats, one must enter them as strings in my current implementation like 1A, 4G and they will be marked automatically in real time and shown to the user in red color. Now I wished to know if there is a way I can remove the input part from keyboard and just allow the user to click on a seat and it gets selected? How can I achieve this? Please help as I have no idea about mouse inputs... (I am a beginner in such matters) Thank You in advance!

26th May 2017, 5:31 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
12 Answers
+ 4
sorry bro I forget to post the code. here is the code https://code.sololearn.com/cwnpB9LUGia2/?ref=app
30th May 2017, 5:54 AM
MR Programmer
MR Programmer - avatar
+ 2
@MR Programmer Will you be kind enough to answer as well?
26th May 2017, 6:33 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
you have to use a graphics library like sdl or #include <Windows.h> // inside main POINT p; GetCursorPos(&p); p.x --------> x pos of mouse p.y----------> y pos of mouse
26th May 2017, 6:34 AM
MR Programmer
MR Programmer - avatar
+ 2
@MR Programmer I specified that I can get the coordinates of the character I want to recieve a click on... All I wish to know is how to call thr book function I have made when the user presses the left key on the seat 1A or 4H
26th May 2017, 6:40 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
I could get you , do you want. button so that when you press it do something
26th May 2017, 6:46 AM
MR Programmer
MR Programmer - avatar
+ 2
Tell me how to make that... Ill modify it according to my requirements
26th May 2017, 6:48 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
but you have to change lots of code , because button comes on the category of gui.
26th May 2017, 6:50 AM
MR Programmer
MR Programmer - avatar
+ 2
You are using SDL or Windows.h?
26th May 2017, 6:51 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
Windows.h , sdl still Learning​
26th May 2017, 6:51 AM
MR Programmer
MR Programmer - avatar
+ 2
It doesn't matter, just give it to me. Ill modify. That will help me learn
26th May 2017, 6:51 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
Still Waiting... Just till tomorrow... Then...
27th May 2017, 11:56 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
Do you need the code ?
26th May 2017, 7:35 AM
MR Programmer
MR Programmer - avatar