Duda con oGet:cText

Post Reply
User avatar
José Luis Sánchez
Posts: 484
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España
Contact:

Duda con oGet:cText

Post 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
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Duda con oGet:cText

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Duda con oGet:cText

Post 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()
Regards

G. N. Rao.
Hyderabad, India
User avatar
José Luis Sánchez
Posts: 484
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España
Contact:

Re: Duda con oGet:cText

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Duda con oGet:cText

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
José Luis Sánchez
Posts: 484
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España
Contact:

Re: Duda con oGet:cText

Post 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
Post Reply