Page 1 of 1

Duda con oGet:cText

Posted: Tue Jun 18, 2019 2:50 pm
by José Luis Sánchez
Hola a todos,

Cuando hago una llamada a un formulario para recoger una clave de una tabla auxiliar, en esa función tengo que asignar el valor de la clave ajena al objeto Get que llama. Por ejemplo, tengo el siguiente botón:

Code: Select all

   REDEFINE BUTTON aGet[ 16 ] ID 116 OF oDlg ;
      ACTION FpSeleccion( bCO:CoFormaPag, aGet[ 15 ], oDlg, , )
   aGet[16]:cTooltip := 'Seleccionar forma de pago'
 
y luego en FpSeleccion tengo esto:

Code: Select all

FUNCTION FpSeleccion( cFormapag, oGet1, oParent, nMove, oGet2, oGet3 )
...
   ACTIVATE DIALOG oDlg CENTERED       ;
      ON PAINT oDlg:Move( aPoint[ 1 ], aPoint[ 2 ],,, .T. )

   IF lOK
      cFormapag := FP->FpPago
      IF oGet1 != NIL
         oGet1:cText( FP->FpPago )
      ENDIF
      IF oGet2 != NIL
         oGet2:cText( FP->FpCuenta )
      ENDIF
      IF oGet3 != NIL
         oGet3:cText( FP->FpCatIngr )
      ENDIF
   ENDIF
 
La duda que tengo es si debo usar el método oGet:SetText() en vez de oGet:cText() y que diferencia hay entre ambos.

Saludos,
José Luis

Re: Duda con oGet:cText

Posted: Tue Jun 18, 2019 2:52 pm
by hmpaquito
Hola José Luis,

Yo siempre lo he hecho así:

Code: Select all

      cFormapag := FP->FpPago
      IF oGet1 != NIL
         oGet1:VarPut( FP->FpPago )
         oGet1:Refresh()
      ENDIF
Saludos

Re: Duda con oGet:cText

Posted: Tue Jun 18, 2019 6:27 pm
by nageswaragunupudi
Use cText

cText := uNewValue
or
cText( uNewValue )

Method cText( uNewValue ) calls oGet:VarPut( uNewValue ) and in addition refreshes and sets new text in window.

Do not use SetText()

Re: Duda con oGet:cText

Posted: Wed Jun 19, 2019 2:59 pm
by José Luis Sánchez
Thnaks Mr Rao,
What happends if the variable inside the get is a hash value ? I'm having the problem that some times the value un the get is refreshed and other times don't. Do I need to pase the variable in reference mode ?

Regards,
José Luis

Re: Duda con oGet:cText

Posted: Wed Jun 19, 2019 3:06 pm
by nageswaragunupudi
May I see how are you defining the Get?
Is it something like

GET oGet VAR hHash[ "item"] SIZE ............... ACTION ... ?

In this case also it works.

Re: Duda con oGet:cText

Posted: Wed Jun 19, 2019 3:11 pm
by José Luis Sánchez
Sorry, I was having an stupid error. I was using a value parameter to receive an expresion value, I changed this for a variable inside the function and it's working good.

Regards,
José Luis