I have a listbox that I want to convert to xBrowse.. with using the COLUMNS syntax .. I have a code block that returns a value that populates a column. ( DispType( oRsVEH ) )
It is that codeblock that errors and I do not know of a way to return the value I want to display in the specific column .. here is the code :
Also notice .. my old listbox code turned a row a specific color nased on a certain data condition .. i have not been able to figure that one out yet either ..
Rick Lipkin
- Code: Select all Expand view
cTITLE := "SELECT * from VEHICLES where AGENCY = '"+xAGENCY+"'"
nWd := GetSysMetrics(0) * .50
nHt := GetSysMetrics(1) * .8
lOK := .F.
DEFINE ICON oICO RESOURCE "KEY"
DEFINE WINDOW oWnd1 ;
FROM 10,10 to nHt, nWd PIXEL ;
TITLE cTITLE ;
MENU BuildMenu(oRsVEH) ;
ICON oICO ;
NOMINIMIZE ;
NOZOOM ;
MDICHILD
@ 0, 0 xBROWSE oBrw of oWnd1 ;
RECORDSET oRsVeh ;
COLUMNS 'VNUMBER', ;
EVAL( {|x|Disptype( oRsVeh) } ),; // <-- error here
'LICENSE', ;
'AGENCY', ;
'MAKE', ;
'TYPE', ;
'YEAR', ;
'PROG', ;
'MOTORPOOL', ;
'REGION', ;
'LASTSERVCE', ;
'NEXTSERVCE', ;
'NEXTMILAGE', ;
'SERIALNUMB', ;
'ACTIVE' ;
COLSIZES 48,50,80,50,120,120,55,95,95,140,80,80,80,190,30 ;
HEADERS "Vnum", ;
"Type", ;
"License", ;
"Agency", ;
"Make", ;
"Model", ;
"Year", ;
"Program", ;
"Mtrpool", ;
"Location", ;
"LastServ", ;
"NextServ", ;
"NextMilage", ;
"Serial#", ;
"Act" ;
AUTOSORT AUTOCOLS LINES CELL
oBrw:CreateFromCode()
oWnd1:oClient := oBrw
oBrw:bLDblClick := { |nRow,nCol | _VehView( "V", oRsVeh ) }
* oBrw:bKeyDown := { |nKey| _Manual( nKey,oRs ) }
* oBrw:nClrText := { || SelColor( oRsVEH:Fields("readonly"):Value, "F", 1 ) }
* oBrw:nClrPane := { || SelColor( oRsVEH:Fields("readonly"):Value, "B", 1 ) }
* oBrw:nClrForeFocus := { || SelColor( oRsVEH:Fields("readonly"):Value, "F", 2 ) }
* oBrw:nClrBackFocus := { || SelColor( oRsVEH:Fields("readonly"):Value, "B", 2 ) }
ACTIVATE WINDOW oWND1 ;
ON INIT( oBrw:SetFocus(), .F. ) ;
VALID ( IIF( !lOK, _VehClose(.T., oRsVEH), .F. ))
RETURN( .T. )
//------------------------------
Static FUnc SelColor( cSTATUS, cTYPE, nTYPE )
LOCAL nCOLOR := CLR_BLACK
DO CASE
CASE cTYPE = 'F' .and. nTYPE = 1 // foreground
IF cSTATUS = "Y"
nCOLOR := CLR_WHITE
ELSE
nCOLOR := CLR_BLACK
ENDIF
CASE cTYPE = 'B' .and. nTYPE = 1 // background
IF cSTATUS = "Y"
nCOLOR := RGB(179,203,204)
ELSE
nCOLOR := CLR_WHITE
ENDIF
CASE cTYPE = 'F' .and. nTYPE = 2 // foreground
IF cSTATUS = "Y"
nCOLOR := RGB(255,0,0 ) //CLR_WHITE
ELSE
nCOLOR := CLR_BLACK
ENDIF
CASE cTYPE = 'B' .and. nTYPE = 2 // background
IF cSTATUS = "Y"
nCOLOR := RGB(179,203,204)
ELSE
nCOLOR := rgb(192,192,192) //CLR_WHITE
ENDIF
ENDCASE
RETURN( nCOLOR )
//----------------------
Static Func DispType( oRsVEH )
Local cTYPE := SPACE(5)
DO CASE
CASE oRsVEH:Fields("V_TYPE"):Value = "V"
cTYPE := "VEH"
CASE oRsVEH:Fields("V_TYPE"):Value = "E"
cTYPE := "EQUIP"
CASE oRsVEH:Fields("V_TYPE"):Value = "B"
cTYPE := "BOAT"
OTHERWISE
cTYPE := "UNK"
ENDCASE
RETURN( cTYPE )
//----------------------
Static Func DispMemo( oRsVEH )
Local cMEMO, cMESSAGE
cMEMO := oRsVeh:Fields("memo"):Value
cMESSAGE := " "
IF empty(alltrim(cMEMO))
ELSE
cMESSAGE := " see memo "
ENDIF
RETURN( cMESSAGE )