Duda con oGet:cText

Duda con oGet:cText

Postby José Luis Sánchez » Tue Jun 18, 2019 2:50 pm

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  Expand view
  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  Expand view
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
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: Duda con oGet:cText

Postby hmpaquito » Tue Jun 18, 2019 2:52 pm

Hola José Luis,

Yo siempre lo he hecho así:

Code: Select all  Expand view
     cFormapag := FP->FpPago
      IF oGet1 != NIL
         oGet1:VarPut( FP->FpPago )
         oGet1:Refresh()
      ENDIF


Saludos
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Duda con oGet:cText

Postby nageswaragunupudi » Tue Jun 18, 2019 6:27 pm

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
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Duda con oGet:cText

Postby José Luis Sánchez » Wed Jun 19, 2019 2:59 pm

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
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: Duda con oGet:cText

Postby nageswaragunupudi » Wed Jun 19, 2019 3:06 pm

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
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Duda con oGet:cText

Postby José Luis Sánchez » Wed Jun 19, 2019 3:11 pm

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
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 38 guests