I define a Xbrowse like this.
- Code: Select all Expand view
- aVelden6 := { ;
{ "naam" , "Naam" ,nil, 125 , NIL}, ; // 3
{ "voornaam" , "Voornaam" ,nil, 125 , NIL}, ; // 4
{ "ploeg2017" , "P2017" ,"@!", 75, NIL}, ; // 5
{ "truitjesnum", "Num" ,"999", 50 }, ; // 16
{ "Actief" , "Actief" ,nil, 95 , NIL}, ; // 6
{ "Nonactief" , "Beschikbaar" ,"@D", 80 ,NIL},; // 12
{ "T1_1" , "T1" ,"@!", 25 ,2}, ; // 9 // 2 is center
{ "T1_2" , "T2" ,"@!", 25 ,2}, ; // 9
{ "T1_3" , "T3" ,"@!", 25 ,2}, ; // 9
{ "T1_4" , "T4" ,"@!", 25 ,2}, ; // 9
{ "T1_5" , "T5" ,"@!", 25 ,2}, ; // 9
{ "T1_6" , "T6" ,"@!", 25 ,2}, ; // 9
{ "M1_1" , "M1" ,"@!", 45 ,2}, ; // 9
{ "M1_2" , "M2" ,"@!", 45 ,2}, ; // 9
{ "M1_3" , "M3" ,"@!", 45 ,2}, ; // 9
{ "M1_4" , "M4" ,"@!", 45 ,2}, ; // 9
{ "memo" , "Memo" ,"@!", 240 ,NIL}}
@ 0,0 XBROWSE oBrw[6] size -1,-1 PIXEL OF oFld:aDialogs[ 6 ] font oFont ;
DATASOURCE oRs ;
COLUMNS aVelden6;
AUTOSORT CELL LINES NOBORDER FOOTERS FASTEDIT
Also a Combobox like this (For selecting a specific month (Januari, Februari,...)
Action : If I change the combo to a new month, the browse should take the new fields.
- Code: Select all Expand view
- @ 65,550 COMBOBOX oCbx VAR nMaand SIZE 100,400 PIXEL HEIGHTGET 18 OF oDlg ;
ITEMS aMaanden ON CHANGE (changebrowse(nMaand),oBrw[6]:refresh())
and the function (This should update the fields in the Xbrowse array aVelden[6] what is used to create the Xbrowse.
I can't get the Xbrowse refresh with the new fields in the array aVelden [6]
- Code: Select all Expand view
Function changebrowse(nMaand)
for i = 1 to 6
aVelden6[6+I][1] = "T"+alltrim(str(nMaand))+"_"+alltrim(str(I))
next
for i = 1 to 4
aVelden6[12+I][1] = "M1_"+alltrim(str(i))
next
return
Mr. Rao had a code like this, that is working for DBF. Not for My oRs.
- Code: Select all Expand view
- function BrowseData()
local oDlg, oFont, oCbx, oBrw
local nMonth := 1
local aMonths[ 12 ]
local nOffSet
AEval( aMonths, { |c,i| aMonths[ i ] := NtoCMonth( i ) } )
nOffSet := MARCV->( FIELDPOS( "T1_1" ) ) - 4
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL FONT oFont
@ 20,20 COMBOBOX oCbx VAR nMonth SIZE 200,400 PIXEL OF oDlg ;
ITEMS aMonths ON CHANGE oBrw:Refresh()
@ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "MARCV" ;
COLUMNS "ID", "Name", ;
{ || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet ) ) }, ;
{ || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet + 1 ) ) }, ;
{ || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet + 2 ) ) }, ;
{ || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet + 3 ) ) } ;
HEADERS nil, nil, "C1", "C2", "C3", "C4" ;
PICTURES nil, nil, "9999", "9999", "9999", "9999" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil