Screen clear function

Just starting out? Need help? Post your questions and find answers here.
samxxx
User
User
Posts: 10
Joined: Sun Oct 09, 2022 5:17 pm

Screen clear function

Post by samxxx »

I am trying to clear the screen after I type something, not the whole screen just after I get a output.
User avatar
Demivec
Addict
Addict
Posts: 4277
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Screen clear function

Post by Demivec »

Do you have some sample runnable code showing things up to the point you have a question?
samxxx
User
User
Posts: 10
Joined: Sun Oct 09, 2022 5:17 pm

Re: Screen clear function

Post by samxxx »

This will just be an example:
PrintN ("Enter your name")

After I type a name how can I clear the screen after I hit enter.
User avatar
idle
Always Here
Always Here
Posts: 5984
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Screen clear function

Post by idle »

For console the command is ClearConsole()

Code: Select all

EnableExplicit 

EnableGraphicalConsole(#True)
Global firstname.s,lastname.s

OpenConsole() 

PrintN("Enter your first name") 
firstname.s = Input() 
ClearConsole()  
PrintN("Enter your last name") 
lastname.s = Input() 
ClearConsole() 
PrintN("Hello " + firstname + " " + lastname) 
Input() 
ClearConsole() 
Print("Done") 
Input() 

CloseConsole() 
End 
Olli
Addict
Addict
Posts: 1251
Joined: Wed May 27, 2020 12:26 pm

Re: Screen clear function

Post by Olli »

Hello samxxx,


you maybe send a small answer to the other subject you created. This helps to build the dialog.

It is also for you, to know the quality of the tool pureBasic.

Because there are several modes of interface.
- the normal console
- the "graphical" console
- the requesters (single questions and single answers in any standard windows)
- the standard GUI (graphic user interface) (no black background)
- the accelerated display (for 2D/3D)

So, do not hesitate to answer, what you like, and what it should be too complex for the moment.

Good coding !
infratec
Always Here
Always Here
Posts: 7658
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Screen clear function

Post by infratec »

If you are using a console output, you can simply send backspace characters to delete the line.
Or, if you use a graphical console: place the cursor at he beginning of the line and print spaces.
Or do you mean a real 'screen' (OpenScreen), then you can draw a box.

So you need to told us what exactly you mean with screen.
And if possible show us a working example.
Post Reply