Demo19 Demo 19 - Per-cell Colors/Fonts Form15` Table1 TgDemo MS Sans Serif EntryDate EntryDate Project TaskGroup Target Target Production Production Marketing Marketing Operations Operations Accounting Accounting Legal Legal Department Department Person Person StartDate StartDate Duration Duration Data1R Data1% OE.MDB )select * from tasklist order by entrydate &Corporate Task Database as of 12/20/93 Table1_ClickX Table1_Append Data1 Recordset Table1_MouseDown Button Shift Table1t PointXy PointY sortCol ColumnAtPoint RecordSource ColumnName* Columnsn ColumnHeadFontStyle GRF_INHERIT GRF_UBOLD ColumnFieldV GRF_UNDER GRF_UNDERLINE GRF_ULINE Table1_RowChange# projCol deptCol TgFindColumn ColumnText( ParamBackColor CYANK ParamFontStyle INHERIT_FONT ParamForeColor INHERIT_COLORs ColumnHasRegex ColumnHasRegexAttr ColumnSetRegex ColumnAddRegex( ColumnAddRegexAttr lastProjValue lastDeptValue6 ColorizeSimilarItems Table1_Update Value Form_Load GRF_BOLD todaysDate ColumnCellAttrs targetCol doneCol colTarget@ colDone Table1_FetchAttributes Status Split FgColor BgColor FontStyle GRF_ITALIC targetText colTask LT_YELLOW ForeColor- DK_RED Form_Unload Cancel QuitCurrentDemo RowAtPointH work variable last value for current project last value for current department todaysDate is used to simulate a current date pre-lookup values for column numbers ColorizeSimilarItems This subroutine assures that all projects and departments which are the same as the current row are highlighted. This is done by using TrueGrid's automatic pattern matching. Weg tell TrueGrid the color to use for matched patterns. Lookup the column numbers so we don't have to hardcode them.u TaskGroup Department Set the colors/fonts which will be applied based upon the pattern match.t s$ will be the project name for the current row There is a project: add a pattern to matcht current project name anywhere it occurs int the column. Project is blank ... clear the pattern matching Remember the last project so we don't cause undue flicker.a s$ is now the current department name.c We have a department name. Set a pattern so similar departments are highlighted. No department. Turn off pattern colorization for this column.T Remember the last department value used.a Form_Load Lookup frequently used column numbers for efficency Target Simulate a fixed date so the display looks the same all the time. 12/20/93 Set up the DONE column so that "No" is always ina bold. For the Target and Task columns, tell TrueGrid to ask for attributes on a case-by-case basis in the FetchAttributes event.a Underline the EntryDate column since it represents the initial sort order. EntryDate Form_Unload Table1_Append Downarrow at the last row adds a new record.e Table1_FetchAttributes Determine the cell attributes dynamically as they are requested.c The target date is in red italic if it's before todays date. We use ColumnText to fetch theo date value from the column. For tasks which aren't done, make sure that the Task column has a yellow background.h Table1_MouseDown The right button causes us to sort on the given column if pressed in the heading area.o Determine the column we clicked over. SELECT * FROM TASKLIST ORDER BY [ Reset the heading fonts, then set the selected column so that it's underlined. Table1_RowChange Upon a row change, color the project andl departments which are the samer Table1_Update If the data in the Project or Department columns changes, then recolorize the grid to reflect similar projects/departments. TaskGroup Department