home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR19 / OBJPROB.ZIP / TESTCMND.PRG < prev   
Text File  |  1993-10-26  |  2KB  |  62 lines

  1.  
  2. /*
  3. ╔═══════════════════════════════════════════════════════════════╗
  4. ║ Módulo: TestCmnd.prg                                          ║
  5. ║ Lenguaje: Clipper 5.0x + ObjectsP                             ║
  6. ║ Fecha: Marzo  1993                                            ║
  7. ║ Compilar: Clipper TestMess /a /n /w                           ║
  8. ║ Desc.:Demo/Test de la clase Command                           ║
  9. ║                                                               ║
  10. ║ (c) 1993 Francisco Pulpón y Antonio Linares                   ║
  11. ╚═══════════════════════════════════════════════════════════════╝
  12. */
  13.  
  14. Function TestCommand( cParam1 )
  15. local mQO := Command( "QOut" )
  16. local mSetRow, mGetClass, mNew
  17. local oGet
  18.  
  19.  
  20.   mQO:exec( "¡ Olé ¡ Primero llamamos a QOut() !" )
  21.  
  22.   mQO:exec( "El objeto Command llamó a la función:", mQO:name() )
  23.  
  24.   // test del método send genérico, mandando mensajes a objetos...
  25.   mSetRow = Command():New( "_Row" )
  26.  
  27.   mQO:exec( "Creamos un objeto get sin iniciar y un objeto Command -> '_Row'" )
  28.  
  29.   oGet = Get():New()
  30.  
  31.   mQO:exec( "oGet:row contiene:", oGet:row )
  32.  
  33.   mQO:exec( "Ahora le mandamos un mensaje oGet:send( mSetRow, 22 ) " )
  34.  
  35.   oGet:send( mSetRow, 22 ) // equivale a oGet:row = 22
  36.  
  37.   mQO:exec( "Ahora oGet:row contiene:", oGet:row )
  38.  
  39.   mQO:exec( "También podemos crear cualquier tipo de objeto conociendo el nombre" )
  40.   mQO:exec( "de su clase a partir de objetos Command...")
  41.  
  42.   mGetClass = Command( "Get" )
  43.   mNew      = Command( "New" )
  44.  
  45.   oGet = mGetClass:exec():send( mNew, 10, 12 )
  46.  
  47.   mQO:exec( "oGet es un objeto creado a partir de dos datos caracter: 'Get' y 'New'" )
  48.   mQO:exec( "oGet:ClassName() devuelve el nombre de la clase del objeto:", oGet:ClassName() )
  49.   ?
  50.   mQO:exec( "Puedes probar a mandarle mensajes a 'oGet' a traves de la linea de comandos" )
  51.   mQO:exec( "Puedes entrar Ej.: 'C:\> testcmnd col'" )
  52.  
  53.   if( pCount() > 0 )
  54.  
  55.       mNew = Command( cParam1 )
  56.  
  57.       mQO:exec( "El mensaje oGet:"+cParam1 + " devuelve -> ", oGet:send( mNew ) )
  58.  
  59.   endif
  60.  
  61. Return nil
  62.