ComboBox inside Txbrowse

ComboBox inside Txbrowse

Postby Ehab Samir Aziz » Fri Sep 01, 2006 5:14 pm

I need to edit a field in txbrowse with an array of DBF field values. How can I implement combobox inside Txbrowse?
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Ehab Samir Aziz » Sat Sep 23, 2006 7:15 pm

I am sorry I do not undestand Spanish but if I converted fixed arrays into the program to field of database I have error messages :
Error description: Error BASE/1068 Argument error: array access

Code: Select all  Expand view
#INCLUDE "FIVEWIN.CH"
procedure main()

LOCAL oWnd, oBrw, aDatos

   //MsgInfo( "Hola Mundo" )

   DEFINE WINDOW oWnd

   *aDatos := { { "uno   ", "dos   ", "tres  ", "cuatro", "cinco " },;
   *            { "Seis  ", "Siete ", "Ocho  ", "Nueve ", "Diez  " } }

    aDatos :=creatarray()
   WITH OBJECT ( oBrw := TXBrowse():New( oWnd ) )
      :SetArray( aDatos )

      WITH OBJECT :aCols[01]
         :cHeader     := "Col1"
         :nEditType   := 01
         :bOnPostEdit    := { |oCol| aDatos[ oBrw:nArrayAt ][01] := oCol:oEditGet:cText }
      END

      WITH OBJECT :aCols[02]
         :cHeader     := "Col2"
         :nEditType   := 02
         :aEditListTxt   := aDatos
         :aEditListBound := :aEditListTxt
         :bOnPostEdit    := { |oCol,cOption| aDatos[ oBrw:nArrayAt ][02] := cOption }
      END

      WITH OBJECT :aCols[03]
         :cHeader     := "Col3"
         :nEditType   := 03
         :bOnPostEdit := { || "" }
         :bEditBlock  := { || MsgInfo( "Hola" ) }
      END

      WITH OBJECT :aCols[04]
         :cHeader     := "Col4"
         :nEditType   := 04
         :aEditListTxt   := aDatos
         :aEditListBound := :aEditListTxt
         :bOnPostEdit    := { |oCol,cOption| aDatos[ oBrw:nArrayAt ][04] := IF( Len( Alltrim( cOption ) ) > 0, cOption, oCol:oEditGet:cText ) }
      END

      WITH OBJECT :aCols[05]
         :cHeader     := "Col5"
         :nEditType   := 05
         :bOnPostEdit := { |oCol| aDatos[ oBrw:nArrayAt ][05] := oCol:oEditGet:cText }
         :bEditBlock  := { || MsgInfo( "Hola" ) }
      END
   :CreateFromCode()

   END
   oWnd:oClient := oBrw

   Activate Window oWnd
  *  TWINDOW():ACTIVATE( oWnd )



function creatarray()
local aData := {},oDlg

use mach
mach->(dbGotop())
do while !mach->(eof())
aadd( aData , mach->mc_serial )
mach->(dbSkip())
enddo
/*
USE THIS ARRAY BY LISTBOX CLASS, you will get the names of mach from DBF
*/

return (aData)

Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests