home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pcmagazi / 1992 / 20 / updget.prg < prev    next >
Text File  |  1992-07-12  |  2KB  |  43 lines

  1. ********************************************************************
  2. * UpdateGet( cGetName, uValue ) or                    Clipper 5.01
  3. * UpdateGet( cGetName )
  4. *
  5. * This function will update the value of a GET currently
  6. * displayed on the screen and redisplay the GET.
  7. *
  8. * cGetName is is the name of the GET to update.  The name
  9. * must be specified exactly as it was when the get was issued.
  10. * For example, if a get is issued as item->quantity and you
  11. * try the statement:
  12. *
  13. *     UpdateGet( "quantity", 5 )
  14. *
  15. * it will fail. In this case, you must specify the complete
  16. * alias as it was specified in the @ GET statement,
  17. * item->quantity. The name specified is NOT case sensitive.
  18. *
  19. * uValue is the new value to place in the get.
  20. *
  21. * Returns .T. if the get was found and the value set,
  22. *  .F. otherwise.
  23. ********************************************************************
  24. FUNCTION UpdateGet( cGetName, uValue )
  25. LOCAL oGet, nPos
  26. IF ( nPos := ASCAN( GetList, { | e | UPPER( e:name ) == ;
  27.      UPPER( cGetName ) } ) ) > 0
  28.    oGet := GetList[ nPos ]           // Access the GET object
  29.    IF PCOUNT() > 1
  30.      oGet:VARPUT( uValue )           // Send it the update msg
  31.    ENDIF
  32.    oGet:DISPLAY()                    // Send it the display msg
  33. ENDIF
  34. RETURN ( nPos > 0 )                  // .T. if found, otherwise .F.
  35.  
  36. ********************************************************************
  37. * UpdateGets()                                       Clipper 5.01
  38. * Display the current values of all GETS in GetList
  39. ********************************************************************
  40. FUNCTION UpdateGets()
  41. AEVAL( GetList, {|oGet| oGet:DISPLAY() } )
  42. RETURN NIL
  43.