combobox of field inside Txbrowse

combobox of field inside Txbrowse

Postby Ehab Samir Aziz » Sun Sep 24, 2006 3:47 pm

How to use this program to field array instead of fixed array ?

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

Postby ShumingWang » Thu Sep 28, 2006 1:56 am

obrow := TXBrowse():New( odlg )

for i:=1 to len(array1)
oCol := obrow:addCol()
addcol(ocol,i)
next

return



function addcol(ocol,i)

oCol:cHeader :='aaa'
oCol:bStrData := { ||array1[i]}
ocol:beditvalue:={||array[i]}
ocol:nedittype:= 1
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .... }

return

Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests