In my conversion (16 to 32) , I used the folowing TS browse call a lot of times : (In a older NTX format for indexes)
REDEFINE BROWSE oLbxCol CELLED COLORS CLR_BLACK, CLR_WHITE ALIAS "kleuren" ID 3333 OF oDlg
NewLbx(oLbxcol,"ARTIKEL")
and this is the function, that I want to convert to Xbrowse. Can someone help me with this function?
I think that the indexes are not needed anymore, because Xbrowse allready know how to handle them?
- Code: Select all Expand view
function NewLbx(oLbx,cType)
Local aTmp:={}
cType = upper(alltrim(cType))
DO case
// Titel Field Size Edit Indexen Align 0-L,1-M,2-R,3-V
CASE cType == "ARTIKEL"
AADD(aTmp,{"Code" ,"artikel_nr" ,70 ,.F. ,"artikel" ,0 })
AADD(aTmp,{"Lev.Code" ,"ref_lev" ,90 ,.F. ,"" ,0 })
AADD(aTmp,{"Benaming" ,"Benaming" ,400 ,.F. ,"artnaam" ,0 })
AADD(aTmp,{"Mag" ,"stonowtot" ,50 ,.F. ,"" ,2 })
AADD(aTmp,{"Min" ,"stomintot" ,50 ,.F. ,"" ,2 })
AADD(aTmp,{"Teveel" ,"stonowtot" ,50 ,.F. ,"" ,2 })
CASE cType == "GOMPROSPECT"
AADD(aTmp,{"Naam" ,"naam" ,120 ,.F. ,"aboeknom" ,0 })
AADD(aTmp,{"Straat" ,"straat" ,100 ,.F. ,"aboekstr" ,0 })
AADD(aTmp,{"Gemeente" ,"Gemeente" ,100 ,.F. ,"aboekgem" ,0 })
AADD(aTmp,{"Volume" ,"Grootte" ,50 ,.F. ,"" ,2 })
AADD(aTmp,{"Telefoon" ,"Tel1" ,70 ,.T. ,"" ,0 })
AADD(aTmp,{"Activiteit","activiteit" ,150 ,.T. ,"" ,0 })
AADD(aTmp,{"Zone" ,"welk_it" ,100 ,.T. ,"" ,0 })
OTHERWISE
msginfo("Missing data","Programma fout")
return
Endcase
nKoloms = len(aTmp)
FOR I = 1 TO nKoloms
ADD COLUMN TO oLbx ;
MOVE DT_MOVE_RIGHT ;
EDITABLE ;
ALIGN DT_RIGHT,DT_CENTER,DT_RIGHT // cells, header, footer
oLbx:ACOLUMNS[I]:CHEADING := aTmp[i][1]
oLbx:SetData(I, FieldWBlock( aTmp[i][2], Select() ) )
oLbx:SETCOLSIZE(I, aTmp[i][3])
oLbx:aColumns[I]:lEdit := aTmp[i][4]
oLbx:aColumns[I]:cOrder := aTmp[i][5]
oLbx:SetAlign(I, 1, aTmp[I][6] ) // ( nCol, nLevel, nAlign ) nLevel 1 Cell, 2 Header, 3 Footer
If aTmp[i][4] // Edit = .t.
oLbx:SetColor( { 1,2 }, { CLR_BLACK, CLR_WIJZIG }, I )
EndIF
NEXT
aTmp:={}
oLbx:SetColor( { CLR_EDITF, CLR_EDITB }, { CLR_BLACK, CLR_YELLOW } ) // Editing
oLbx:SetColor( { 14 }, { CLR_HRED, CLR_BLACK } ) // Rood voor de actieve indexen
oLbx:lNoHScroll := .T. // Geen H Scrollbar by default
return
I found this code of Mr. Rao, that is a function call to Xbrowse, but is not that easy to convert.
- Code: Select all Expand view
FUNCTION N21A_DEFCOLUMN(_oBR, D_COLUMNAS)
LOCAL X:=0, _PIC, _COLOR:=""
LOCAL _NCOLOR
LOCAL D_COLSIZES := {}
PRIVATE NCOLOR1 := CLR_WHITE, NCOLOR2 := CLR_HGRAY, NCOLOR3 := CLR_GRAY
PRIVATE NCOLOR4 := CLR_YELLOW, NCOLOR5 := CLR_WHITE, NCOLOR6 := CLR_HGRAY
PRIVATE NCOLOR7 := CLR_WHITE, NCOLOR8 := CLR_HGRAY, NCOLOR9 := CLR_GRAY
D_COLSIZES:={}
FOR X = 1 TO LEN(D_COLUMNAS)
AADD(D_COLSIZES, IIF(D_COLUMNAS[X,3] < 3 , 40 , D_COLUMNAS[X,3] * 9 ) )
_NCOLOR:= "NCOLOR" + ALLTRIM(IIF(X < 10, STR(X), "2"))
_NCOLOR:= &_NCOLOR
_PIC := IIF(D_COLUMNAS[X,2] = "N", REPLICATE("9",D_COLUMNAS[X,3]) + ".9999", REPLICATE("!",D_COLUMNAS[X,3]) )
ADD COLUMN TO XBROWSE _oBR ;
DATA FIELDWBLOCK( D_COLUMNAS[ x, 1 ], SELECT( "ST" ) ) ; //( N21A_FieldSetGetBlock( "ST", x ) ) ;
HEADER D_COLUMNAS[X,1] SIZE (D_COLSIZES[X]) ;
COLOR CLR_BLACK , _NCOLOR ;
PICTURE _PIC ;
EDITABLE
NEXT
return nil
I only need this as a temporary solution, to get my 16 bit going in 32 bit. After this, for the important browses, I gone use Xbrowse on the best way, coded like Mr. Rao mostly suggest.
Thanks allready.