Announcement

Collapse
No announcement yet.

Carriage return mark when using INKEY$

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Amos Vryhof
    Guest replied
    As kInput is written as a Work-alike for Input, the inVar$
    would be the "Input Variable"

    So:

    Input "What?", a$

    and

    kInput "What?", a$

    are equivalent statements.

    ------------------
    Amos
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Mel Bishop
    replied
    Originally posted by Amos Vryhof:

    case keycode$(63) 'F5
    if pbvScrnRows=25 then
    width 80,50
    else
    width 80,25
    end if
    exit loop
    case chr$(13):exit loop
    case keycode$(59): userInput$=userInput$+"F1"
    case else

    Try changing the line:

    case chr$(13):exit loop

    to

    case chr$(13):invar$ = chr$(13) : exit sub

    This will by-pass the print statements after the LOOP. I don't
    know what invar$ is or does but apparently you need it for
    processing elsewhere. If you don't need it elsewhere (it's just
    an exit flag), try:

    case chr$(13) : exit sub



    ------------------

    Leave a comment:


  • Amos Vryhof
    Guest replied
    An example.....it'e a remake of Input with Inkey so special
    keystrokes can be captured. Sorry about the lack of
    documentation.

    Code:
    SUB kInput(promptString$,inVar$)
    userInput$=""
    curln%=CSRLIN
    if curln%>(pbvScrnRows-1) then curln%=(pbvScrnRows-1)
    plen%=LEN(promptString$)+1
    llen%=79-plen%
    print promptString$
    
    locate curln%,plen%
    do
            myInput$=inkey$
    	select case myInput$
            	case chr$(27):userInput$=""
                    case chr$(8)
                            if uiLen%=0 then exit select
                            if uiLen%=(llen%-1) then exit select
                    	userInput$=left$(userInput$,(uiLen%-1))
                    case chr$(9): userInput$=userInput$+space$(5)
                    case keycode$(72)	'Up Arrow
                    case keycode$(75)	'Left Arrow
                            if uiLen%=0 then exit select
                            if uiLen%=(llen%-1) then exit select
                    	userInput$=left$(userInput$,(uiLen%-1))
                    case keycode$(77)	'Right Arrow
                    case keycode$(80)	'Down Arrow
                    case keycode$(63)	'F5
                    	if pbvScrnRows=25 then
                            	width 80,50
                            else
                            	width 80,25
                            end if
                            exit loop
                    case chr$(13):exit loop
                    case keycode$(59): userInput$=userInput$+"F1"
     	       	case else
                    	userInput$=userInput$+myInput$
             end select
    	 locate curln%,plen%
             uiLen%=LEN(userInput$)
             color 7,0
             print userInput$;
             color 23,0
             print chr$(249);
             color 7,0
             print SPACE$(llen%-uiLen%)
    loop
    locate curln%,plen%
    uiLen%=LEN(userInput$)
    print userInput$+SPACE$(llen%-uiLen%+1)
    inVar$=userInput$
    END SUB
    
    FUNCTION keycode$(codenum%)
    	FUNCTION=chr$(0)+chr$(codenum%)
    END FUNCTION
    ------------------
    Amos
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Dan Soper
    replied
    Clay: $LIB IPRINT has been supported since v2.00 at least.

    I dimly recall symbols being printed instead of carriage returns if either a CHR$(13) or a CHR$(10) was present without the other, i.e. a Mac or Unix text file. If my memory is correct on that, then it's likely the same thing would have happened if CHR$(10, 13) were inadvertently used instead of CHR$(13, 10).

    ------------------
    --Dan

    Leave a comment:


  • Clay Clear
    replied
    Fred,

    IPrint is a library included with PB/DOS. I do not know if it
    goes back as far as version 3.0. I know it's in my version
    3.5.

    To use it, near the beginning of your source file, put the
    statement:

    $LIB IPRINT ON

    IPrint is a library that enables Interpreted Print. This is what will
    enable true CR/CRLF behavior, instead of the program printing
    out chars instead of actual CR's.

    Hope this helps!

    Cordially,


    ------------------
    Clay C. Clear
    mailto:[email protected][email protected]</A>
    Clay Clear's Software (Frames Only)

    Leave a comment:


  • Mel Bishop
    replied
    How about posting a code snippet so we can get a better grasp of
    what's happening. I don't wanna sound rude but I don't have any
    idea of what you are talking about.


    ------------------

    Leave a comment:


  • Fred Katzel
    replied
    Mel

    I have PowerBASIC Compiler Version 3. As I indicate in my last
    message I have discovered that the carriage return consist of a
    single word with a length of 0 units. I have been unable to use
    it to produce a carriage return when I come to printing out the
    letter. So I am using <00> as a placeholder, <00< if I want a
    carriage return after a placeholder and word< when I want a
    carriage return after a word. For a blank line I use a single <.

    Thanks

    Fred K


    ------------------

    Leave a comment:


  • Mel Bishop
    replied
    Well, first of all, I need to know two things:

    1. What version of PB are you using?

    2. How are the strings you want printed stored? Are they in
    memory or are you basically doing a screen dump?

    One suggestion if they are in memory:

    temp$ = remove$(temp$,chr$(10))
    temp$ = remove$(temp$,chr$(13))

    >> or <<

    replace chr$(10) with chr$(32) in temp$
    ditto with chr$(13)


    ------------------




    [This message has been edited by Mel Bishop (edited June 15, 2002).]

    Leave a comment:


  • Fred Katzel
    replied
    Hi

    Eric and Mel I'm not familiar with IPRINT and the PB file.
    The only thing I have in my manual is the following statement'
    ".PB: A configuration file for the intergrated environment.
    This file allows..." on page 5 of the manual printed in 1989.
    Where can I find information on IPRINT?

    Mel, I have been using your suggestion all along I was just
    wondering if their was some way to test for the return mark when
    I come to printing.

    Fred K



    ------------------

    Leave a comment:


  • Mel Bishop
    replied
    IPRINT would be your best bet but another train of thought:

    When you press a key, you are apparently printing the character
    first then evaluating it for something, possibly to exit a DO/LOOP.

    Try evaluating it first. Then, if it's a printable character, go
    ahead and print it. Otherwise... (?exit loop?).


    ------------------

    Leave a comment:


  • Eric Pearson
    replied
    Check out the $LIB IPRINT metastatement in the PB Help File.

    -- Eric

    ------------------
    Perfect Sync Development Tools
    Perfect Sync Web Site
    Contact Us: mailto:[email protected][email protected]</A>

    Leave a comment:


  • Fred Katzel
    started a topic Carriage return mark when using INKEY$

    Carriage return mark when using INKEY$

    Hi

    I have been using INKEY$ to put text into a form letter set-up.
    However, when I press return a musical note appears. When I come
    to print out the letter the computer doesn't recognize the carriage
    return mark. Is there any way to get the computer to recognize this
    mark?

    Fred K

    ------------------
Working...
X
😀
🥰
🤢
😎
😡
👍
👎