GetInput 3/3

 BBS: Inland Empire Archive
Date: 01-03-93 (00:22)             Number: 348
From: VICTOR YIU                   Refer#: NONE
  To: IMRAN HAYAT                   Recvd: NO  
Subj: GetInput     3/3               Conf: (2) Quik_Bas
>>>>>>>>>--------- last of GETINPUT.BAS

                CASE CLeft$     ' move to previous word
                    IF Cursor > 2 THEN
                        Temp = Cursor - 1     ' assume starting position
                        DO                      ' start loop
                            Temp = Temp - 1     ' adjust pointer
                            IF ASC(MID$(Out$, Temp)) = 32 THEN  ' space?
                                Temp = Temp + 1  ' yes, so move cursor to
                                EXIT DO          ' next word & exit
                            END IF
                        LOOP UNTIL Temp = 1  ' just in case for no spaces
                        Cursor = Temp           'adjust cursor
                    ELSE
                        Cursor = 1
                    END IF
                CASE CRight$
                    IF Cursor <= LEN(Out$) THEN 'only if not end of line
                        Temp = INSTR(Cursor, Out$,
SpaceBar$) ' find next space
                        IF Temp = 0 THEN            ' any spaces at all?
                            Cursor = LEN(Out$) + 1  ' no, so just put at
                                                    ' end of line
                        ELSE
                            Cursor = Temp + 1    ' yes, put after space
                        END IF
                    ELSE
                        Cursor = LEN(Out$) + 1
                    END IF
                CASE Home$
                    Cursor = 1
                CASE End$
                    Cursor = LEN(Out$) + 1
                CASE Insert$
                    Insert = NOT Insert     ' if user pressed the insert
                                            ' key, just toggle flag
            END SELECT
        END IF
    LOOP

    LOCATE , , 0, 0, 16     ' restore cursor to invisible big block
    PRINT                   ' go to next line

    GetInput$ = Out$        ' assign function to value
END FUNCTION                ' exit

-----------8<--------------8<------ that's it!

Hope it helps!
Victor

P.S.  Watch out for word-wrapped lines...

... My spelling?  Oh, it's just line noise.
--- Blue Wave/RA v2.10 [NR]
 * Origin: Hard Disc Cafe / Houston Texas / (713) 589-2690
/ RA 1.11 / (1:106/30.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET