Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataset OnFilterRecord question

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I am looking into using this function, but I'm not sure if it will do what I need.
I have a dataset that is tied to a query that returns specific information for a particular day. I would like to display this information in two parts, morning and afternoon (SCHEDTIM < 1200 and > 1200). I was thinking perhaps two DBGrids (one for am and one for pm) and using the Filter, but I can't see how to use OnFilterRecord and filter for two different things. Is there a way to make the DBGrid &quot;split&quot; at the separation point? Can I color the afternoon rows a different color? Any other suggestions?

Thanks!

Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
I don't think it's possible to &quot;split&quot; data from one DadaSource into several DBGrids (at least common DBGrids), but you do can paint rows in different colors. There is a good FAQ &quot;Coloring selected Row in a dbgrid&quot; by Svanhooft in the FAQ area.

--- markus
 
Set the DefaultDrawing of the DBGrid to false

Use the OnDrawColumnCell event and type in:


procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);

begin
if Table1Salary.Value > 26000 then
DBGrid1.Canvas.Font.Color := clRed;
// this is your condition

DBGrid1.DefaultDrawDataCell(Rect,dbgrid1.Columns[datacol].Field, State);
end;

I used the employee table from the DBDemos for testing

Regards Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top