4glworks reference: Text Editor

ted_checkop

file itedl.4gl
declaration
function ted_checkop(r)
    define r smallint
returns nothing
purpose Handy little function that takes the result of ted_fileread or ted_filewrite and outputs an appropiate message
example none
notes none

ted_clear

file itedl.4gl
declaration
function ted_clear()
returns nothing
purpose Clears the text editor screen array
example none
notes none

ted_features

file itedl.4gl
declaration
function ted_features(a, i)
    define a,			#use autowrap?
	   i	smallint	#use file IO?
returns nothing
purpose Used to turn on/off certain text editor features
example none
Notes Can be used at any time

ted_fileread

file itedl.4gl
declaration
function ted_fileread(f, m, s, z)
    define f	char(70),		#path to file
	   m,				#maximum amount of lines in the buffer
	   s,				#start line
	   z	smallint		#initial buffer count
returns result, integer, operation result
purpose Reads a file into the ted buffer
example none
notes
  • if f is null, the routine will open a window on which a file name can be provided
  • ted_fileread will insert the contents of file f at line s, preserving subsequent lines, until the overall contents of the buffer reach m
  • to initialize the buffer with the contents of a file, set s to 1 and z to 0

ted_filewrite

file itedl.4gl
declaration
function ted_filewrite(f, m)
    define f	char(70),		#path to the file
	   m	smallint		#amount of lines to write
returns
purpose Writes the contents of the ted buffer into a file
example none
notes if f is null, the routine will open a window on which a file name can be provided

ted_fromtext

file itedl.4gl
declaration
function ted_fromtext(t)
    define t	text
returns Nothing
purpose Copies the contents of text variable t into the text editor array
example none
notes none

ted_fromuni

file itedl.4gl
declaration
function ted_fromuni()
returns Nothing
purpose Copies the contents of the currently active uni_scroller pane into the text editor array
example none
notes none

ted_input

file itedl.4gl
declaration
function ted_input(dir, enb)
    define dir,			#-1 if cursor to be positioned on last line
	   enb	smallint	#true if part of an INPUT statemet
returns
  • 1, if the input should continue with the next field
  • -1, if the input should continue with the previous field
  • 0, if the user has pressed the ACCEPT or INTERRUPT field
purpose The text editor itself
example none
notes none

ted_show

file itedl.4gl
declaration
function ted_show()
returns nothing
purpose Displays the initial portion of the text editor buffer on the associated screen array
example none
notes none

ted_start

file itedl.4gl
declaration
function ted_start(s, t, e, n)
    define s,			# screen lines
	   t,			# max text lines
	   e,			# no blank lines?
	   n	smallint	# text needed?
returns nothing
purpose Sets the properties of the text editor
example none
notes Needs to be called once, the editor buffer gets used. Calling this function in between ted_input calls on the same text is likely to disrupt ted_input functionality.

ted_totext

file itedl.4gl
declaration
function ted_totext(t)
    define t	text
returns Nothing
purpose Copies the contents of the text editor array into text variable t
example none
notes none

ted_touni

file itedl.4gl
declaration
function ted_touni()
returns Nothing
purpose Copies the contents of the text editor array into the currently active uni_scroller pane
example none
notes none