Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //METODY
- void Edit::userText()
- {
- char charly; //Zmienna na wpisany znak
- bool bolek = 1; //gdy klikniemy ENTER wychodzi z petli
- COORD tempc;
- tempc.X = c.X;
- tempc.Y = c.Y;
- //Wyswietla text
- SetConsoleCursorPosition(hc, c);
- this->display();
- tempc.X += RealTextLength;
- while (bolek)
- {
- //Ustawia dobrze podkreslnik
- SetConsoleCursorPosition(hc, tempc);
- charly = _getch();
- if ((int)charly == 13) //Jesli ENTER to wychodzi z petli
- {
- bolek = 0;
- }
- else
- {
- if ((int)charly == 8 && tempc.X > c.X) //Dzialanie Backspace + zabezpieczenie
- {
- tempc.X--;
- text[tempc.X - c.X] = ' ';
- SetConsoleCursorPosition(hc, tempc);
- cout << text[tempc.X - c.X];
- }
- else
- {
- if (tempc.X < (c.X + Length) && (int)charly != 8) // Podstawianie znaku + zabezpieczenie
- {
- text[tempc.X - c.X] = charly;
- SetConsoleCursorPosition(hc, tempc);
- cout << text[tempc.X - c.X];
- tempc.X++;
- }
- }
- }
- }
- }
- void Edit::display()
- {
- cout << getText();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement