User Tools

Site Tools


getline_return_line_of_text_.htm
Navigation:  ABC Library Reference > ASCIIFileClass > AsciiFileClass Methods >====== GetLine (return line of text) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

GetLine( line number ), PROC

blk2blue.jpg

GetLine Returns a line of text.
line number An integer constant, variable, EQUATE or expression that contains the offset or position of the line of text to return.

The GetLine method returns the line of text specified by line number.

Implementation:

The GetLine method gets a line at position line number from the ASCII file, extending the index queue if needed. If the index queue already contains the requested line number then the file is read using the existing offset, otherwise the index is extended. If the requested line number does not exist in the file, the text line is cleared and ERRORCODE() set.

Return Data Type:     STRING

Example:

MyViewer.DisplayPage PROCEDURE(LONG LineNo)

LineOffset USHORT,AUTO

CODE

IF LineNo > 0                              !line specified?

 SELF.ListBoxItems=SELF.ListBox{PROP:Items} !note size of list box

 FREE(SELF.DisplayQueue)                    !free the display queue

 SELF.GetLine(LineNo+SELF.ListBoxItems-1)   !index to end of page

 LOOP LineOffset=0 TO SELF.ListBoxItems-1   !for each listbox line

 !read ASCII file record:

  SELF.DisplayQueue.Line=SELF.GetLine(LineNo+LineOffset)

  IF ERRORCODE()                            !on end of file

   BREAK                                    !stop reading

  END

  ADD(SELF.DisplayQueue)                    !add to display queue

 END

 SELF.TopLine=LineNo                        !note 1st line displayed

 DISPLAY(SELF.ListBox)                      !redraw the list box

END

See Also:     GetLine

getline_return_line_of_text_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1