home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / snip0693.zip / GETS.PRG < prev    next >
Text File  |  1992-09-05  |  1KB  |  42 lines

  1. David, you have to understand how the GET system works in 5.01. You
  2. should NEVER place the variable i a valid anymore, there are far more
  3. reliable methods:
  4.  
  5. instead do the following:
  6.  
  7. @ x, 3 GET a_Gets[x]  VALID {| oGet | somefunc( oGet ) }
  8. .
  9. .
  10. READ
  11.  
  12. // validation:
  13. Function SomeFunc( oGet )
  14.  
  15. local MyVar:=oGet:VarGet()
  16.  
  17. // perform validation....
  18. .
  19. .
  20. .
  21.  
  22. // if you must write a NEW value back into the GET, then perform
  23. // the following:
  24. oGet:VarPut( MyVar )           // places new value back, takes care
  25.                                // any messy array handling!
  26. oGet:Display()                 // redisplays the NEW value!!
  27.  
  28. // as appropriate....
  29. return( lValid )               // did the validation work or not??
  30.  
  31.  
  32. The Get system uses a code block for VALID now, and the block is always
  33. passed the current GET object (allowing us to retrieve and set values
  34. using built in Get methods as I indicated above). If you do it that way,
  35. you will NOT have any problems with arrays.
  36.  
  37. BTW your original problem was associated with the compiler - it turned
  38. your old VALID into a code block, which contained a LIVE reference to
  39. the variable 'x'. When the GET actually went through a validation
  40. process (during READ), 'X' had the value "3" in it - and THAT value was
  41. placed into the code block as it was executed!!!
  42.