Page 1 of 1

combobox of field inside Txbrowse

Posted: Sun Sep 24, 2006 3:47 pm
by Ehab Samir Aziz
How to use this program to field array instead of fixed array ?

Code: Select all


#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) 

Posted: Thu Sep 28, 2006 1:56 am
by ShumingWang
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}
ocol:beditvalue:={||array}
ocol:nedittype:= 1
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .... }

return

Shuming Wang