Skip to content

editlib

These functions read from the current input channel (see inputoutputlib), and what they do depends on it. In a window after WindowInput, Edit$ shows the default text and a cursor and lets the user type a line until Return; after FileInput it reads the next line of the file; from the shell window it reads a line typed there.

Print "Your name? "
name$=Edit$(40)
NPrint "Hello, ",name$

Characters limits how many characters can be typed, which keeps the input from running over other things in a window.

Based on the editlib guide by Acid Software.

Library number 186.

Commands

Edit

Reads a number of at most Characters characters from the current input channel, like Edit$, and returns its value. DefaultValue is shown first to be edited.

Function, result .f. Help text: ([DefaultValue,]Characters)
2 forms:

  • .l
  • .f, .l

With runtime error checking, 0 characters or more than 80 are an error. At the end of the input the value is 0.

Edit$

Reads a line of at most Characters characters from the current input channel and returns it, without the Return. DefaultString$ is shown first to be edited, where the channel allows editing.

Function, result $. Help text: ([DefaultString$,]Characters)
2 forms:

  • .l
  • $, .l

With runtime error checking, 0 characters is the error “Can’t Edit 0 Characters!”. At the end of the input, such as a file given to the program with < in the shell, the result is the empty string.

Inkey$

The characters that are waiting on the current input channel, at most Characters (one without it), or "" if there are none. Not for the default input channel.

Function, result $. Help text: [(Characters)]
2 forms:

  • no arguments
  • .l

Inkey$(0) is the empty string. With runtime error checking, a negative Characters is the error “Can’t Inkey$ a negative number of Characters!”. In the style of Blitz Basic 2, only that check catches it: without it, the count is taken as about 4 billion, so Inkey$ tries that many times to read a character and the program hangs there.