Thread: Setting the curser

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    10

    Question Setting the curser

    I am writting a console text editor. When the user presses
    the Inser key i want the curser to be highlighted and blink until the Insert is on.

    Is there a function that would do something like that??

    I heard about setcursersize() in conio.h but i don't know how to use it.

    Thanks

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    This part entirely depends on your compiler.
    Please post which compiler you use.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    10
    Using Borland, but i also want my code to work on Unix

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > Using Borland, but i also want my code to work on Unix
    Not a chance

    An awful lot of the code will be machine specific, just to generate a level playing field between the two vastly different operating systems.

    A library like ncurses is what you want, if a port of it exists for borland. If not, you could try porting it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    10

    Lightbulb

    Originally posted by pors7
    Using Borland, but i also want my code to work on Unix
    You can use TVision because that is shipping with borland compiler, and it's ported to unix (gcc)!
    #cd pub
    #more beer

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Actually, you can position the curser with ANSI escape codes.
    Additionally, it's possible to write "wrapper" functions, and use #def to modify your code to compile differently in DOS/*nix.

    For *nix, I'd really recommend 'ncurses'. Do a bit of reading on it.

    http://www.delmar.edu/Courses/CIS415L/ANSIsys.htm
    These codes apply to the *nix console enviornment also. (Actually, I've only tried the color and some cursor positioning myself, but hey, they don't call it ANSI for nothing...)

    Quzah.

  7. #7
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    I was under the impression that you could only use escape codes if ansi.sys was loaded.On most modern windows boxes this is not loaded at start-up.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. VS .net project setting question
    By Jumper in forum C++ Programming
    Replies: 1
    Last Post: 05-13-2004, 11:03 AM
  4. Your favourite fantasy game setting?
    By fry in forum Game Programming
    Replies: 4
    Last Post: 10-16-2002, 06:26 AM
  5. Setting the background color of my main window
    By Garfield in forum Windows Programming
    Replies: 5
    Last Post: 07-06-2002, 11:25 PM