10194 : OnValueChangedGrid, I want to overide the new date value with my own default date.

Question

 On my gant chart I have 4 columns setup, two of which are of type tekDate. Inside the OnValueChangedGrid event I am checking the value of the date that the user just modified. If the new value is not a valid date (based on my applications business rules) I want to overide the new date value with my own default date.

Answer

the value will be set in the cell after the event is called
so no matter what you do the cell inside the event will matter. However the
newValue string is a string pointer so you can change it inside the event
try this:

procedure TForm1.phGantXColsValueChangedGrid(Sender: TObject;
const theGant: IphGantX3; const theDataEntity: IphDataEntity_Tree2; X,
Y: Integer; var newValue: WideString);
begin
newValue:=’This Value’;
end;

or in your case:

 if (e.newValue is not Valid)
 {
 e.newValue = defaultDate.ToString();
 }

Leave a Reply