Board index » delphi » HideCursor

HideCursor

Could someone please tell me what should  I add to this short example,
---------------------------------
    Program MyRead;
    var c:char;

    begin
        readln(c);
    end.
-----------------------------------
, to make cursor invisible while entering a character from keyboard.

Gagi

 

Re:HideCursor


Re:HideCursor


Quote
> Could someone please tell me what should  I add to this short example,
> ---------------------------------
>     Program MyRead;
>     var c:char;
>     begin
>         readln(c);
>     end.
> -----------------------------------
> , to make cursor invisible while entering a character from keyboard.

   Try this:

Re:HideCursor


Re:HideCursor


Quote
Simovic wrote:
> Could someone please tell me what should  I add to this short example,
> ---------------------------------
>     Program MyRead;
>     var c:char;

>     begin
>         readln(c);
>     end.
> -----------------------------------
> , to make cursor invisible while entering a character from keyboard.

> Gagi

This is a frequently asked (and answered) question. Before further posting
to this newsgroup, please download and read the following document. It
provides answers to the most commonly asked questions about Turbo/Borland
Pascal.

ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
(this is the correct URL, isn't it?)

Re:HideCursor


Quote
Simovic wrote:
> Could someone please tell me what should  I add to this short example,
> ---------------------------------
>     Program MyRead;
>     var c:char;

>     begin
>         readln(c);
>     end.
> -----------------------------------
> , to make cursor invisible while entering a character from keyboard.

This is a frequently asked (and answered) question. Before further posting
to this newsgroup, please download and read the following document. It
provides answers to the most commonly asked questions about Turbo/Borland
Pascal.

ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
(this is the correct URL, isn't it?)

Re:HideCursor


Re:HideCursor


Quote
> > Could someone please tell me what should  I add to this short example,
> > ---------------------------------
> >     Program MyRead;
> >     var c:char;
> >     begin
> >         readln(c);
> >     end.
> > -----------------------------------
> > , to make cursor invisible while entering a character from keyboard.

>    Try this:

   Well, I screwed up my last post on this thread, so here's
another try:
procedure MyRead (var ST : string; Q : Byte);  { internal string }
var C1,C2 : char;
begin
  ST := '';                           { initialize string length }
  repeat
    C1 := ReadKey;
    case C1 of
      #27  : begin                                      { escape }
             end;
      #00  : begin
               C2 := ReadKey;                  { fetch scan code }
               case C2 of
                 #59  : ;                                   { F1 }
                 #60  : ;                                   { F2 }
                 #61  : ;                                   { F3 }
                 #62  : ;                                   { F4 }
                 #63  : ;                                   { F5 }
                 #71  : ;                                 { Home }
                 #79  : ;                                  { End }
                 #72  : ;                             { Up Arrow }
                 #80  : ;                           { Down Arrow }
                 #108 : ;                               { Alt-F5 }
                 else   begin                       { all others }
                        end
               end  { case }
             end;
      #13  : ;                                             { C/R }
      #08  : begin                                   { Backspace }
               if Length(ST) > 0 then
                 begin
                   Dec (ST[0]);                { truncate string }
                   Write (#08#32#08)
                 end;
             end;
      else   begin                            { normal character }
               ST := ST+C1;    { concatenate character to string }
               Write (C1)
             end
    end;  { case }
  until (C1 = #13) or (Length(ST) >= Q)
end;  { MyRead }

Re:HideCursor


Quote
Mike Copeland wrote in message ...
>> Could someone please tell me what should  I add to this short example,
>> ---------------------------------
>>     Program MyRead;
>>     var c:char;
>>     begin
>>         readln(c);
>>     end.
>> -----------------------------------
>> , to make cursor invisible while entering a character from keyboard.

>   Try this:

Thanks,I've tried it but I can still see cursor.

Meanwhile I found what I needed on Web:

procedure cursoron;
inline($b4/$01/$b7/$00/$b5/$06/$b1/$07/$cd/$10);

Gagi

Re:HideCursor


JRS:  In article <MPG.112eb6edc4504688989...@news.primenet.com> of Fri,
12 Feb 1999 22:09:20 in news:comp.lang.pascal.borland, Mike Copeland

Quote
<mrc...@primenet.com> wrote:
>> Could someone please tell me what should  I add to this short example,
>> ---------------------------------
>>     Program MyRead;
>>     var c:char;
>>     begin
>>         readln(c);
>>     end.
>> -----------------------------------
>> , to make cursor invisible while entering a character from keyboard.

>   Try this:

>[ A UUEncoded file (Myread) was included here. ]

Tut.

How does that make the cursor invisible?

See   http://www.merlyn.demon.co.uk/pascal.htm#Cursor

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v4.00    MIME.
  Web <URL: http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
  Correct 4-line sig. separator is as above, a line precisely "-- " (SoRFC1036)
  Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)

Re:HideCursor


Quote
> >> Could someone please tell me what should  I add to this short example,
> >> ---------------------------------
> >>     Program MyRead;
> >>     var c:char;
> >>     begin
> >>         readln(c);
> >>     end.
> >> -----------------------------------
> >> , to make cursor invisible while entering a character from keyboard.

> >   Try this:

> >[ A UUEncoded file (Myread) was included here. ]

> Tut.

   Yes, my mistake (hit the wrong button on my <new> news reader).  
Corrected in a subsequent post.

Quote
> How does that make the cursor invisible?

   As is sometimes the mistake I make when doing this stuff early in the
morning, I misread the real intent of the post.  Some days, it doesn't
pay to get out of bed (and log on)... 8<{{

Re:HideCursor


Re:HideCursor


hi Simovic

not the easiest, but the best way is, to define the cursor shape.
by doing this, you can modify the cursor after your wished.
a full block cursor, a one line cursor, no cursor and the standard cursor
are no poblem.

source:
    const    cs_standard  = $0607;    { standard cursor }
                cs_nothing   = $1500;    { no visibable cursor }
                cs_halfblock = $0715;    { a half block cursor }
                cs_fullblock = $0015;    { a full block cursor }

    procedure set_cursor_shape(shape : word); assembler;
    asm
        mov ah, 01h
        mov cx, shape
        int 10h
    end;

this works 100%
i hope i helped you
lehmi

Simovic schrieb:

Quote
> Could someone please tell me what should  I add to this short example,
> ---------------------------------
>     Program MyRead;
>     var c:char;

>     begin
>         readln(c);
>     end.
> -----------------------------------
> , to make cursor invisible while entering a character from keyboard.

> Gagi

Other Threads