Shop OBEX P1 Docs P2 Docs Learn Events
Clearing the terminal — Parallax Forums

Clearing the terminal

EnriqueEnrique Posts: 90
edited 2008-05-21 12:06 in General Discussion
Hi,
·
I remember reading somewhere that one can print certain control characters that will clear the terminal screen, this using the System.out.print() statement. Needless to say I looked all over but cannot find those characters. Can anyone point me in the right direction?
·
·
Thanks,
·
Enrique

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-05-21 10:54
    Here are the codes I know and their function:

    · public static final int JIDE_HOME··· = 1;· //move cursor to upper-left position (home)
    · public static final int JIDE_LEFT··· = 3;· //move cursor one position to left
    · public static final int JIDE_RIGHT·· = 4;· //move cursor one position to right
    · public static final int JIDE_UP····· = 5;· //move cursor one line up
    · public static final int JIDE_DOWN··· = 6;· //move cursor one line down
    · public static final int JIDE_BELL··· = 7;· //sound bell
    · public static final int JIDE_BS····· = 8;· //delete character to left of cursor and move cursor left
    · public static final int JIDE_TAB···· = 9;· //appears to be ignored by IDE message window
    · public static final int JIDE_NEWLINE = 10; //move cursor to start of next line
    · public static final int JIDE_CR····· = 13; //appears to be ignored by IDE message window
    · public static final int JIDE_CLS···· = 16; //clear message window and home cursor

    regards peter
  • EnriqueEnrique Posts: 90
    edited 2008-05-21 11:47
    I’m using this statement

    System.out.print(“\16&#8221[noparse];)[/noparse];

    but the terminal is not cleared


    Enrique
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-05-21 11:54
    I think you need to use
    System.out.print('\u0010');
    to clear the screen (remember, you need to send a character, not a number or string).
    Or use System.out.print((char)JIDE_CLS);

    regards peter
  • EnriqueEnrique Posts: 90
    edited 2008-05-21 12:06
    It worked.


    Thanks
Sign In or Register to comment.