Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Options to control the cursor on the terminal without using ncurses lib?: (5 Items)
   
Options to control the cursor on the terminal without using ncurses lib?  
Hello all.

OS:     QNX 6.4.1
Code: C

For my consolen-app it's importend to have control of the cursor.
Of course, ncurses delivers functions for that, but it was so much work to recode my app to implement ncurses.

What options do I have features like getyx(int* y, int* x) and gotoyx(int y, int x)?

Thanks for help.

Best regards,

Sven
Re: Options to control the cursor on the terminal without using ncurses lib?  
Hi,

refer to the devc-con docs for a list of supported ANSI screen control codes. They'll work with pterm as well.

- Thomas 
Re: Options to control the cursor on the terminal without using ncurses lib?  
Hi Thomas.

Do you mean the document from HELP-QNX Monentics IDE?

I found options to add chars and n spaces on the console, but not a function that return me the oordinates of the 
current corsor position or to put the cursor on a position declared with row and colum (x, y).

Regards,
Sven

Re: Options to control the cursor on the terminal without using ncurses lib?  
Hi Sven,

to position the cursor, issue
   CSI [ <row> [ ';' <col> ] ] 'H'

where CSI is either ESC followed by '[' or 0x9B (in 8-bit-mode).

E.g., on the command line, do
   printf '\x1b[H%s' Hello
to print 'Hello' at row 0, column 0, 
   printf '\x1b[%dH%s' 11 Hello
to print 'Hello' at row 11, column 0, and
   printf '\x1b[%d;%dH%s' 11 22 Hello
to print 'Hello' at row 11, column 22.

Reading the position has never really worked for me. What you can do, however, is to save and restore the cursor 
position.
To save, issue
   CSI s
to restore, use
   CSI u

- Thomas
Re: Options to control the cursor on the terminal without using ncurses lib?  
Hi Thomas.

But, how can I save the positions for e.g. n Threads?
If I correct understand CSI-command is only for one position, isn't it?

Regards,
Sven