Page 1 of 1

Error usando aEditListBound en xBrowse

PostPosted: Mon Nov 28, 2022 2:00 pm
by horacio
Amigos, estoy utilizando una base de datos dbf en un xbrowse con la clase TDatabase, el cliente me pide que pueda editar los registros directamente de la tabla. Cuando quiero implementar un combobox y utilizo esta variable de clase los datos de la columna donde quiero aplicarla desaparecen, si la quito funciona pero me guarda el valor de aEditListtxt

Code: Select all  Expand view

Case 6
    :aCols[ i ] : nEditType      := EDIT_LISTBOX
    :aCols[ i ] : cHeader        := "T. PAGO"
    :aCols[ i ] : nDataStrAlign := AL_CENTER
    :aCols[ i ] : aEditListtxt  := {"ADELANTADA", "VENCIDA"}
    :aCols[ i ] : aEditListBound := { "A", "V" }
 

Hay algo que no estoy teniendo en cuenta? desde ya muchas gracias.
Saludos

Re: Error usando aEditListBound en xBrowse

PostPosted: Mon Nov 28, 2022 2:17 pm
by karinha
C:\FWH..\SAMPLES\TESTXBRW.PRG lynea: 619

Regards, saludos.

Re: Error usando aEditListBound en xBrowse

PostPosted: Mon Nov 28, 2022 5:23 pm
by horacio
Gracias por contestar, el ejemplo es con un array y no con una dbf con la clase TDatabase. Con esas características no funciona por lo menos para mi.

Saludos

Re: Error usando aEditListBound en xBrowse

PostPosted: Tue Nov 29, 2022 10:35 am
by horacio
+1

Re: Error usando aEditListBound en xBrowse

PostPosted: Tue Nov 29, 2022 12:17 pm
by nageswaragunupudi
Referring to your code:
Code: Select all  Expand view
:aCols[ i ] : aEditListtxt  := {"ADELANTADA", "VENCIDA"}
    :aCols[ i ] : aEditListBound := { "A", "V" }
 


This means that what is displayed on the screen in the listbox is aEditListTxt, i.e., "ADELANTADA", "VENCIDA".
Depending on the user's choice, it should write either "A" or "V" in the DBF.
Is that what you want ?

Re: Error usando aEditListBound en xBrowse

PostPosted: Tue Nov 29, 2022 1:29 pm
by horacio
Hola Rao, exactamente es eso lo que quiero hacer.

Saludos

Re: Error usando aEditListBound en xBrowse

PostPosted: Tue Nov 29, 2022 1:46 pm
by nageswaragunupudi
I have prepared a sample using TDatabase.
Please run it and check.
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDbf

   CreateDBF()

   oDbf  := TDataBase():Open( , "LISTBOX", "DBFCDX", .t. )
   XBROWSER oDbf TITLE "JUST CREATED"

   DoBrowse( oDbf )

   XBROWSER oDbf TITLE "AFTER EDIT"

return nil

static function DoBrowse( oDbf )

   local oDlg, oFont, oBrw

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oDbf AUTOCOLS CELL LINES NOBORDER;
      FASTEDIT

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      WITH OBJECT :aCols[ 2 ]
         :nEditType        := EDIT_LISTBOX
         :nWidth           := 160
         :aEditListtxt     := {"ADELANTADA", "VENCIDA"}
         :aEditListBound   := { "A", "V" }
         :bClrEdit         := { || { CLR_BLACK, CLR_YELLOW } }
      END
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

static function CreateDBF()

   local i, aData := Array( 10 )

   DBCREATE( "LISTBOX.DBF", { ;
      { "NAME",   "C",   8, 0 }, ;
      { "PAGO",   "C",   1, 0 }, ;
      { "AMOUNT", "N",   8, 2 } }, "DBFCDX", .T., "LB" )

   for i := 1 to 10
      aData[ i ] := { "Name" + StrZero( i, 2, 0 ), ;
                      If( HB_RandomInt( 0, 1 ) == 1, "A", "V" ), ;
                      HB_RandomInt( 12345, 54321 ) }
   next i

   FW_ArrayToDBF( aData )

   CLOSE DATA

return nil
 


Do you want the same functionality?
Doe this sample help you?
Let us know please.

Re: Error usando aEditListBound en xBrowse

PostPosted: Thu Dec 01, 2022 6:22 pm
by horacio
Mr Rao, no entiendo el ejemplo, yo necesito que al abrir el combo se muestre "ADELANTADA", "VENCIDA" y una vez asignada en la base de datos se guarde "A" o "V". Muchas gracias

Saludos

Re: Error usando aEditListBound en xBrowse

PostPosted: Sat Dec 03, 2022 7:15 pm
by nageswaragunupudi
We will now run the above sample.

See the data in the dbf at the beginning.
Image

PAGO field of 1st record "Name01" is "V".
PAGO field of 3rd record "Name03" is "A".

Now we will change PAGO of 1st record to "A" and 3rd record to "V" with list box of XBrowse like this:

Image

After changes using xbrowse LISTBOX:

Image

We have successfully changed 1st record PAGO to "A" and 3rd record to "V"