FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Error usando aEditListBound en xBrowse
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Error usando aEditListBound en xBrowse
Posted: Mon Nov 28, 2022 02: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 (fw): Select all Collapse
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
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Error usando aEditListBound en xBrowse
Posted: Mon Nov 28, 2022 02:17 PM

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

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Error usando aEditListBound en xBrowse
Posted: Mon Nov 28, 2022 05: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

Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Error usando aEditListBound en xBrowse
Posted: Tue Nov 29, 2022 10:35 AM

+1

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Error usando aEditListBound en xBrowse
Posted: Tue Nov 29, 2022 12:17 PM
Referring to your code:
Code (fw): Select all Collapse
: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
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Error usando aEditListBound en xBrowse
Posted: Tue Nov 29, 2022 01:29 PM

Hola Rao, exactamente es eso lo que quiero hacer.

Saludos

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Error usando aEditListBound en xBrowse
Posted: Tue Nov 29, 2022 01:46 PM
I have prepared a sample using TDatabase.
Please run it and check.
Code (fw): Select all Collapse
#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
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Error usando aEditListBound en xBrowse
Posted: Thu Dec 01, 2022 06: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Error usando aEditListBound en xBrowse
Posted: Sat Dec 03, 2022 07:15 PM
We will now run the above sample.

See the data in the dbf at the beginning.


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:



After changes using xbrowse LISTBOX:



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



G. N. Rao.

Hyderabad, India

Continue the discussion