Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SELECT * from SYS(2005) INTO TABLE testtest
REPLACE ALL type WITH 'INFO' FOR RECNO() % 3 = 0
REPLACE ALL type WITH 'JOE' FOR RECNO() % 4 = 0
REPLACE ALL type WITH 'FRED' FOR RECNO() % 5 = 0
This.column5.dynamicbackcolor = ;
"IIF(MOD(recno(), 2) = 0, RGB(125,125,125), RGB(255,255,255))"
*... Form method TypeFontBold ...*
PARAMETERS search_string
IF VARTYPE(search_string) # 'C'
RETURN .F.
ENDIF
DO CASE
CASE 'PRE' $ (search_string)
RETURN .T.
CASE 'INFO' $ (search_string)
RETURN .T.
OTHERWISE
RETURN .F.
ENDCASE
*... end TypeFontBold
This.column1.dynamicfontbold = ;
"ThisForm.TypeFontBold(testtest.type)"
This.column1.dynamicfontItalic = ;
"ThisForm.TypeFontItalic(testtest.type)"
This.column3.dynamicfontbold = ;
"!EMPTY(testtest.name)"
*... Form method TypeForeColor ...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'INFO'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'JOE'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'FRED'
RETURN RGB(0,0,0) &&...black
OTHERWISE
RETURN RGB(255,255,255) &&...white
ENDCASE
*... end TypeForeColor ...*
*... Form method TypeBackColor ...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
RETURN RGB(255,0,0) &&... lite red
CASE search_string = 'INFO'
RETURN RGB(0,255,255) &&... lite blue
CASE search_string = 'JOE'
RETURN RGB(255,0,255) &&... fucia
CASE search_string = 'FRED'
RETURN RGB(0,255,0) &&... lite green
ENDCASE
*... end TypeBackColor ...*
This.column1.dynamicbackcolor = ;
"ThisForm.TypeBackColor(testtest.type)"
This.column1.dynamicforecolor = ;
"ThisForm.TypeForeColor(testtest.type)"
*... Form method IDBackColor...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
IF 'WIN' $ ID
RETURN RGB(0,255,255) &&... lite blue
ELSE
RETURN RGB(0,0,128) &&... dark blue
ENDIF
CASE search_string = 'INFO'
IF 'WIN' $ ID
RETURN RGB(255,0,255) &&... fucia
ELSE
RETURN RGB(255,255,0) &&... yellow
ENDIF
CASE search_string = 'JOE'
IF 'WIN' $ ID
RETURN RGB(0,255,0) &&... lite green
ELSE
RETURN RGB(0,128,0) &&... dark green
ENDIF
CASE search_string = 'FRED'
IF 'WIN' $ ID
RETURN RGB(255,0,0) &&... lite red
ELSE
RETURN RGB(128,0,0) &&... dark red
ENDIF
ENDCASE
*... end IDBackColor...*
*... Form method IDForeColor ...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&...white
ENDIF
CASE search_string = 'INFO'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'JOE'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&... white
ENDIF
CASE search_string = 'FRED'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&... white
ENDIF
ENDCASE
*... end IDForeColor...*
This.column2.dynamicbackcolor = ;
"ThisForm.IDBackColor(testtest.type)"
This.column2.dynamicforecolor = ;
"ThisForm.IDForeColor(testtest.type)"
***************************************************************
PUBLIC MultiColorGrid
SELECT * FROM SYS(2005) ;
INTO TABLE TestTest
REPLACE ALL type WITH 'INFO' FOR RECNO() % 3 = 0
REPLACE ALL type WITH 'JOE' FOR RECNO() % 4 = 0
REPLACE ALL type WITH 'FRED' FOR RECNO() % 5 = 0
GO TOP
MultiColorGrid = CREATEOBJECT("MultiColorGrid")
MultiColorGrid.Show
RETURN
DEFINE CLASS MultiColorGrid AS form
Top = 0
Left = 1
Height = 274
Width = 500
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT grid1 AS grid WITH ;
Height = 228, ;
Left = 12, ;
RecordSource = "testtest", ;
Top = 24, ;
Width = 490, ;
Name = "Grid1"
PROCEDURE typefontbold
PARAMETERS search_string
IF VARTYPE(search_string) # 'C'
RETURN .F.
ENDIF
DO CASE
CASE 'PRE' $ (search_string)
RETURN .T.
CASE 'INFO' $ (search_string)
RETURN .T.
OTHERWISE
RETURN .F.
ENDCASE
ENDPROC
PROCEDURE typefontitalic
PARAMETERS search_string
IF VARTYPE(search_string) # 'C'
RETURN .F.
ENDIF
DO CASE
CASE 'PRE' $ (search_string)
RETURN .T.
CASE 'INFO' $ (search_string)
RETURN .T.
OTHERWISE
RETURN .F.
ENDCASE
ENDPROC
PROCEDURE typebackcolor
*FUNCTION BackTypeColor
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
RETURN RGB(255,0,0) &&... lite red
CASE search_string = 'INFO'
RETURN RGB(0,255,255) &&... lite blue
CASE search_string = 'JOE'
RETURN RGB(255,0,255) &&... fucia
CASE search_string = 'FRED'
RETURN RGB(0,255,0) &&... lite green
ENDCASE
ENDPROC
PROCEDURE typeforecolor
*FUNCTION ForeTypeColor
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'INFO'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'JOE'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'FRED'
RETURN RGB(0,0,0) &&...black
ENDCASE
ENDPROC
PROCEDURE idforecolor
*... Form method IDForeColor ...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&...white
ENDIF
CASE search_string = 'INFO'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'JOE'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&... white
ENDIF
CASE search_string = 'FRED'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&... white
ENDIF
ENDCASE
*... end IDForeColor...*
ENDPROC
PROCEDURE idbackcolor
*... Form method IDBackColor...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
IF 'WIN' $ ID
RETURN RGB(0,255,255) &&... lite blue
ELSE
RETURN RGB(0,0,128) &&... dark blue
ENDIF
CASE search_string = 'INFO'
IF 'WIN' $ ID
RETURN RGB(255,0,255) &&... fucia
ELSE
RETURN RGB(255,255,0) &&... yellow
ENDIF
CASE search_string = 'JOE'
IF 'WIN' $ ID
RETURN RGB(0,255,0) &&... lite green
ELSE
RETURN RGB(0,128,0) &&... dark green
ENDIF
CASE search_string = 'FRED'
IF 'WIN' $ ID
RETURN RGB(255,0,0) &&... lite red
ELSE
RETURN RGB(128,0,0) &&... dark red
ENDIF
ENDCASE
*... end IDBackColor...*
ENDPROC
PROCEDURE grid1.Init
This.column5.dynamicbackcolor = ;
"IIF(MOD(recno(), 2) = 0, RGB(125,125,125), RGB(255,255,255))"
This.column1.dynamicfontbold = ;
"ThisForm.TypeFontBold(testtest.type)"
This.column3.dynamicfontbold = ;
"!EMPTY(testtest.name)"
This.column1.dynamicfontItalic = ;
"ThisForm.TypeFontItalic(testtest.type)"
This.column1.dynamicbackcolor = ;
"ThisForm.TypeBackColor(testtest.type)"
This.column1.dynamicforecolor = ;
"ThisForm.TypeForeColor(testtest.type)"
This.column2.dynamicbackcolor = ;
"ThisForm.IDBackColor(testtest.type)"
This.column2.dynamicforecolor = ;
"ThisForm.IDForeColor(testtest.type)"
ENDPROC
ENDDEFINE
*
*-- EndDefine: testtest
**************************************************
FOR jj = 1 TO This.ColumnCount
STORE 'Column' + ALLTRIM(STR(jj)) TO MyColumn
This.&MyColumn..dynamicbackcolor = ;
"ThisForm.hilite(ALLTRIM(ThisForm.Text1.Value), " + ;
"This.&MyColumn..controlsource)"
NEXT
*... Form method hilite ...
PARAMETERS search_string, cfield
DO CASE
CASE TYPE(cfield) = "C" OR TYPE(cfield) = "M"
IF search_string $ EVAL(cfield)
RETURN RGB(0,255,255) &&... lite blue
ENDIF
CASE TYPE(cfield) = "N"
IF search_string $ STR(EVAL(cfield))
RETURN RGB(255,0,0) &&... lite red
ENDIF
CASE TYPE(cfield) = "D"
IF search_string $ DTOC(EVAL(cfield))
RETURN RGB(0,255,0) &&... lite red
ENDIF
OTHERWISE
* nop. Not pretty, but I got lazy
ENDCASE
***************************************************************
PUBLIC MultiColorGrid
WAIT WINDOW 'Creating test data...' NOWAIT
SELECT * FROM SYS(2005) ;
INTO TABLE testtest
REPLACE ALL type WITH 'INFO' FOR RECNO() % 3 = 0
REPLACE ALL type WITH 'JOE' FOR RECNO() % 4 = 0
REPLACE ALL type WITH 'FRED' FOR RECNO() % 5 = 0
GO TOP
MultiColorGrid = CREATEOBJECT("MultiColorGrid")
MultiColorGrid.Show
RETURN
DEFINE CLASS MultiColorGrid AS form
Top = 0
Left = 1
Height = 274
Width = 500
DoCreate = .T.
Caption = "MultiColorGrid Demo"
Name = "Multicolorgrid"
ADD OBJECT grid1 AS grid WITH ;
Height = 228, ;
Left = 12, ;
RecordSource = "testtest", ;
Top = 24, ;
Width = 490, ;
Name = "Grid1"
PROCEDURE typefontbold
PARAMETERS search_string
IF VARTYPE(search_string) # 'C'
RETURN .F.
ENDIF
DO CASE
CASE 'PRE' $ (search_string)
RETURN .T.
CASE 'INFO' $ (search_string)
RETURN .T.
OTHERWISE
RETURN .F.
ENDCASE
ENDPROC
PROCEDURE typefontitalic
PARAMETERS search_string
IF VARTYPE(search_string) # 'C'
RETURN .F.
ENDIF
DO CASE
CASE 'PRE' $ (search_string)
RETURN .T.
CASE 'INFO' $ (search_string)
RETURN .T.
OTHERWISE
RETURN .F.
ENDCASE
ENDPROC
PROCEDURE typebackcolor
*FUNCTION BackTypeColor
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
RETURN RGB(255,0,0) &&... lite red
CASE search_string = 'INFO'
RETURN RGB(0,255,255) &&... lite blue
CASE search_string = 'JOE'
RETURN RGB(255,0,255) &&... fucia
CASE search_string = 'FRED'
RETURN RGB(0,255,0) &&... lite green
ENDCASE
ENDPROC
PROCEDURE typeforecolor
*FUNCTION ForeTypeColor
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'INFO'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'JOE'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'FRED'
RETURN RGB(0,0,0) &&...black
ENDCASE
ENDPROC
PROCEDURE idforecolor
*... Form method IDForeColor ...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&...white
ENDIF
CASE search_string = 'INFO'
RETURN RGB(0,0,0) &&...black
CASE search_string = 'JOE'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&... white
ENDIF
CASE search_string = 'FRED'
IF 'WIN' $ ID
RETURN RGB(0,0,0) &&...black
ELSE
RETURN RGB(255,255,255) &&... white
ENDIF
ENDCASE
*... end IDForeColor...*
ENDPROC
PROCEDURE idbackcolor
*... Form method IDBackColor...*
PARAMETERS search_string
DO CASE
CASE search_string = 'PREFW'
IF 'WIN' $ ID
RETURN RGB(0,255,255) &&... lite blue
ELSE
RETURN RGB(0,0,128) &&... dark blue
ENDIF
CASE search_string = 'INFO'
IF 'WIN' $ ID
RETURN RGB(255,0,255) &&... fucia
ELSE
RETURN RGB(255,255,0) &&... yellow
ENDIF
CASE search_string = 'JOE'
IF 'WIN' $ ID
RETURN RGB(0,255,0) &&... lite green
ELSE
RETURN RGB(0,128,0) &&... dark green
ENDIF
CASE search_string = 'FRED'
IF 'WIN' $ ID
RETURN RGB(255,0,0) &&... lite red
ELSE
RETURN RGB(128,0,0) &&... dark red
ENDIF
ENDCASE
*... end IDBackColor...*
ENDPROC
PROCEDURE grid1.Init
This.column5.dynamicbackcolor = ;
"IIF(MOD(recno(), 2) = 0, RGB(125,125,125), RGB(255,255,255))"
This.column1.dynamicfontbold = ;
"ThisForm.TypeFontBold(testtest.type)"
This.column3.dynamicfontbold = ;
"!EMPTY(testtest.name)"
This.column1.dynamicfontItalic = ;
"ThisForm.TypeFontItalic(testtest.type)"
This.column1.dynamicbackcolor = ;
"ThisForm.TypeBackColor(testtest.type)"
This.column1.dynamicforecolor = ;
"ThisForm.TypeForeColor(testtest.type)"
This.column2.dynamicbackcolor = ;
"ThisForm.IDBackColor(testtest.type)"
This.column2.dynamicforecolor = ;
"ThisForm.IDForeColor(testtest.type)"
ENDPROC
ENDDEFINE
*
*-- EndDefine: MultiColorGrid
**************************************************