Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - read activate pending gets http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 read                Activate pending gets
------------------------------------------------------------------------------
 Syntax
   read [save]

 Arguments
   None.

 Description
   The read command activates pending gets and allows editing the get
   fields' contents. Within a read, the user can edit the buffer of each
   get field as well as move from one get field to another. The editing rules
   are defined by the formatting clauses specified for the respective gets.

   The read commands may be nested using the savegets() function and
   restoregets() procedure.

   Unless the save clause is specified, gets are cleared from memory when
   the read terminates.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   vardef static
      uint nCode := 0
   enddef
   
   func uint NestedGets
   // Have a filter routine issue a nested get
   if lastkey() == K_F10                // if F10 is pressed then
      savegets()                        // save the current gets
      @ 10, 50 say "Acct code: " get nCode
      read
      restoregets()                     // restore original get
      return 0                          // tell read to ignore last key pressed
   endif
   return lastkey()
   endproc
   
   proc TestNest
   vardef
      char( 20 ) cName
   enddef
   cName := space( 20 )
   clear
   @ 5, 10 get cName
   read save                 // preserve the get
   read                      // re-reads the previous get, then clears the get
   @ 8, 10 ?? "Press F10 to input account code"
   @ 10, 10 get cName filter NestedGets()
   read
   @ 12, 0 ?? cName, nCode
   endproc
   
   proc TestPicture static
   vardef
      char(20) cString
      dbl     ePos, eNeg
      logical lLog
      date    dToday
   enddef
   clear
   eNeg := -123456.78
   ePos :=  123456.78
   lLog := .t.
   cString := "Hello world"
   dToday := today()
   
   // Template symbols for char
   @ 00, 00 get cString                       // anything
   @ 01, 00 get cString picture "AAAAA"       // alpha
   @ 02, 00 get cString picture "XXXXX there" // X any, other skipped
   @ 03, 00 get cString picture "!!!!!!!!!!!" // any, uppercase
   @ 04, 00 get cString picture "###########" // 0...9, space, +, -, .
   @ 05, 00 get cString picture "99999999999" // 0...9
   @ 06, 00 get cString picture "LLLLLLLLLLL" // tTfFyYjJnN
   @ 07, 00 get cString picture "YYYYYYYYYYY" // yYjJnN uppercase
   
   // Function symbols for char
   @ 09, 00 get cString picture "@!"               // any, uppercase
   @ 10, 00 get cString picture "@S5"              // scroll
   @ 11, 00 get cString picture "@R (AAAAA)AAAAAA" // skip nontemplate chars
   
   // Template symbols for numeric
   @ 13, 00 get eNeg                                 // 0...9
   @ 14, 00 get eNeg    picture "999,999,999.999999" // , and . skipped
   @ 15, 00 get eNeg    picture "99999999"           // 0...9, -
   @ 16, 00 get eNeg    picture "########"           // 0...9, -, space
   
   // Template symbols for logical
   @ 18, 00 get lLog    picture "L"  // tT:T, yY:Y (.t.), nN:N, any:F (.f.)
   @ 19, 00 get lLog    picture "Y"  // yY:Y (.t.), any:F (.f.)
   @ 20, 00 get lLog    picture "."  // space toggles, any: no effect
   
   // Function symbols for date
   set date ansi
   @ 22, 00 get dToday                   // yy.mm.dd (ANSI)
   @ 23, 00 get dToday  picture "@D"     // mm/dd/yy (American)
   @ 24, 00 get dToday  picture "@E"     // dd/mm/yy (British)
   
   read
   endproc
   
   proc Test_read
   TestPicture()
   TestNest()
   endproc

   proc main
   Test_read()
   endproc

See Also: Picture format table get

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson