Error usando aEditListBound en xBrowse

Error usando aEditListBound en xBrowse

Postby horacio » Mon Nov 28, 2022 2:00 pm

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
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Error usando aEditListBound en xBrowse

Postby karinha » Mon Nov 28, 2022 2:17 pm

C:\FWH..\SAMPLES\TESTXBRW.PRG lynea: 619

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error usando aEditListBound en xBrowse

Postby horacio » Mon Nov 28, 2022 5:23 pm

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
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Error usando aEditListBound en xBrowse

Postby horacio » Tue Nov 29, 2022 10:35 am

+1
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Error usando aEditListBound en xBrowse

Postby nageswaragunupudi » Tue Nov 29, 2022 12:17 pm

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 ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Error usando aEditListBound en xBrowse

Postby horacio » Tue Nov 29, 2022 1:29 pm

Hola Rao, exactamente es eso lo que quiero hacer.

Saludos
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Error usando aEditListBound en xBrowse

Postby nageswaragunupudi » Tue Nov 29, 2022 1:46 pm

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Error usando aEditListBound en xBrowse

Postby horacio » Thu Dec 01, 2022 6:22 pm

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
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Error usando aEditListBound en xBrowse

Postby nageswaragunupudi » Sat Dec 03, 2022 7:15 pm

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"
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests