LINES

From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Not supported in Run BASIC

Description

Returns the number of lines in the text window or text-editor. (A line ends with a carriage return, CR).

Syntax

  1. #handle "!lines countVar"
  2. #handle.ext "!lines countVar"

Hints

Place useful hints about this keyword here

Example

nomainwin

WindowWidth=300
WindowHeight=300

statictext #h.st1 "Enter text data", 10, 15, 200, 20
texteditor #h.text 10, 35, 260, 150
button #h.btn "Count lines", [mainExit], UL, 10, 200
statictext #h.st2 "", 100, 200, 100, 25

    open "" for window as #h
    #h "trapclose [quit]"
    '
    'print some sample text to the texteditor window
    '
    #h.text "This is the original contents of the data file. ";chr$(13);_
            "Close window without changing text.";chr$(13);_
            "Then change text and close window to see ";chr$(13);_
            "the difference."
    wait

[mainExit]
    #h.text "!lines cnt"
    #h.st2 "";cnt-1; " lines in the text."
    wait

[quit]                              'close main window
    close #h
    end

Useful Procedures

' Place a useful function or sub using this keyword here