I use a lot of browses in my program. I use these browses with arrays. Now I want to define the visible columns with variables. This is my code now:
- Code: Select all Expand view
@ 30, 10 BROWSE oBrwMain ;
FIELDS "", "", "", "", "", "", "", "";
HEADERS "", "Plantkode", "Latijnse naam", "Nederlandse naam", "Planttype", "", "", "";
OF oWndMain SIZE 950, nScreenHeight-95 ALIAS Alias()
oBrwMain:SetArray( aLatnaam )
oBrwMain:bLine = { | nRow | IF( nRow <= Len( aLatnaam ), aLatnaam[ nRow ], { "", "", "", "", "", "", "", "" } ) }
oBrwMain:SetColBmp( 1 )
oBrwMain:SetColBmp( 6 )
oBrwMain:SetColWidth( 1, 20 )
oBrwMain:SetColWidth( 2, 100 )
oBrwMain:SetColWidth( 3, 350 )
oBrwMain:SetColWidth( 4, 250 )
oBrwMain:SetColWidth( 5, 150 )
oBrwMain:SetColWidth( 6, 25 )
oBrwMain:SetColWidth( 7, 0 )
oBrwMain:SetColWidth( 8, 0 )
oBrwMain:SetColEditable( 1, .F. )
oBrwMain:SetColEditable( 2, .F. )
oBrwMain:SetColEditable( 3, .F. )
oBrwMain:SetColEditable( 4, .F. )
oBrwMain:SetColEditable( 5, .F. )
oBrwMain:SetColEditable( 6, .F. )
oBrwMain:SetColEditable( 7, .F. )
oBrwMain:SetColEditable( 8, .F. )
oBrwMain:SetColor( OwnClrGreen, OwnClrYellow )
oBrwMain:SetRowHeight( nWindowFontSize/2*3 )
oBrwMain:SetFont( cWindowFontName, nWindowFontSize )
I want to define the FIELDS and HEADERS from variables stored in a plist file.
- Code: Select all Expand view
PUBLIC cFields := {"", "", "", "", "", "", "", ""}
PUBLIC cHeaders := {"", "Plantkode", "Latijnse naam", "Nederlandse naam", "Planttype", "", "", ""}
@ 30, 10 BROWSE oBrwMain ;
FIELDS cFields;
HEADERS cHeaders;
OF oWndMain SIZE 950, nScreenHeight-95 ALIAS Alias()
oBrwMain:SetArray( aLatnaam )
oBrwMain:bLine = { | nRow | IF( nRow <= Len( aLatnaam ), aLatnaam[ nRow ], cFields ) }
When I put the HEADERS in an array the program terminates.
Is there a way to do this?