FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Duda con oGet:cText
Posts: 564
Joined: Thu Oct 13, 2005 09:23 AM
Duda con oGet:cText
Posted: Tue Jun 18, 2019 02: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 (fw): Select all Collapse
   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 (fw): Select all Collapse
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
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Duda con oGet:cText
Posted: Tue Jun 18, 2019 02:52 PM
Hola José Luis,

Yo siempre lo he hecho así:

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


Saludos
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Duda con oGet:cText
Posted: Tue Jun 18, 2019 06: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
Posts: 564
Joined: Thu Oct 13, 2005 09:23 AM
Re: Duda con oGet:cText
Posted: Wed Jun 19, 2019 02: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Duda con oGet:cText
Posted: Wed Jun 19, 2019 03: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
Posts: 564
Joined: Thu Oct 13, 2005 09:23 AM
Re: Duda con oGet:cText
Posted: Wed Jun 19, 2019 03: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

Continue the discussion