You are reading help file online using chmlib.com
|
Rave Reports Visual Designer Example OnGetText . |
Top Previous Next |
How to use an event to change colors based upon fractional part of a DateTime field.
{ Event for dtLastEdit.OnGetText } function dtLastEdit_OnGetText(Self: TRaveDataText; var Value: string); var nTime: Double; iHour: Integer; iMinute: Integer; begin nTime := Frac(StrToFloat(Value)); if nTime < 0.25 then self.Color := clRed; Value := 'Before Start'; self.Left := self.Left + 0.1; elseif nTime > 0.75 then self.Color := clYellow; self.Left := self.Left - 0.1; Value := 'After Hours'; else self.Color := clBlack; Value := ''; end if; nTime := nTime * 24; iHour := Trunc(nTime); iMinute := Trunc(Frac(nTime) * 60); If iMinute < 10 then Value := IntToStr(iHour)+':0'+IntToStr(iMinute); else Value := IntToStr(iHour)+':'+IntToStr(iMinute); end if; end OnGetText;
|
You are reading help file online using chmlib.com
|