Additional Activities


Activity 14-5: Read Text File by Page

Modify Read Text File Advanced.vi (from Activity 14-1) so that every time you press a NEXT PAGE button, the VI reads the next PAGE_SIZE characters from file, and when you press a PREVIOUS PAGE button, it reads the previous PAGE_SIZE characters from file. Save your VI as Read Page from Text File.vi.

  • Store the file marker (the current position) in a shift register and increment or decrement it by PAGE SIZE depending on whether the NEXT PAGE or PREVIOUS PAGE button is pressed.

  • Use an Event Structure for capturing button press events.

  • Read the file using the file marker as the start position and page size as the number of characters.

  • Make sure that you do not read before the beginning of the file (position = 0) or past the end of the file (position = end of file + 1).


Now, for extra (geek) points, use a Vertical Scrollbar control (which you learned about in Chapter 13, "Advanced LabVIEW Structures and Functions") to control the page that is read.

Configure the Scrollbar properties, as follows:

  • Set Doc Min to 0 (zero).

  • Set Doc Max to the file size (total number of characters).

  • Set Increment to 1 (one character).

  • Set Page Size to the number of characters you want in a page.





LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net