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 - getid() return the id number of a get field http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getid()             Return the id number of a get field
------------------------------------------------------------------------------
 Declaration
   io.hdr

 Syntax
   func uint getid extern

 Arguments
   None.

 Return
   The identifier number of the current get field.

 Description
   The getid() function returns the id number associated with a get.
   When a get is defined, an optional id may be specified. If an
   optional id is not specified for a get, each get is sequentially
   numbered starting with 1.

   getid() allows a program to determine which get is active during a read.
   This helps in programming standard filters, keyboard handlers, or context-
   sensitive help systems.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   // getid() allows a program to determine which get is active during a read.
   // Use getid() to implement context sensitive help.
   
   func uint GetHelp static
   vardef
      uint nKeyBack
   enddef
   nKeyBack := lastkey()
   if nKeyBack == K_F1
      do case
      case getid() == 1
         @ 16, 1 ?? "Help for", istr( getid() ) + "st get" + space( 6 )
      case getid() == 2
         @ 16, 1 ?? "Another help for get", istr( getid() )
      endcase
   endif
   return( nKeyBack )
   endproc
   
   proc Test_getid
   vardef
      char( 20 ) cName
      uint       nAge
   enddef
   cName := space( 20 )
   nAge := 0
   clear
   @ 10, 1 say "Name: " get cName filter GetHelp() id 1
   @ 12, 1 say "Age : " get nAge  filter GetHelp() id 2
   read
   endproc

   proc main
   Test_getid()
   endproc

See Also: get read

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