Subject | Re: [IBO] TIB_Grid: Autofill on date fields |
---|---|
Author | Wolfgang Rohdewald |
Post date | 2007-01-28T18:39:34Z |
Anybody please?
On Monday 22 January 2007 07:11, Wolfgang Rohdewald wrote:
> Hi,
>
> how can I set Autofill for date fields in a TIB_Grid?
>
> What I tried was putting a TIB_Date control onto the grid
> and setting the DataSource and DataField properties of the date control.
> But the date control seems not to be used..
>
> I also tried something like the following but do not know how to
> get my text into the field - see the first commented line.
>
>
> procedure TMyForm.MyGridKeyPress(Sender: TObject; var Key: Char);
> var
> nowyy,nowmm,nowdd:WOrd;
> begin
> inherited;
> if (key>='0') and (key<='9') then begin
> if (Sender as TIB_Grid).SelectedField.IsDateTime then begin
> DecodeDate(Now,nowyy,nowmm,nowdd);
> nowdd := (ord(key)-ord('0'))*10 + nowdd mod 10;
> // (Sender as TIB_Grid).SelectedField.Text :=
> // ReplaceChars(Format('%2d.%2d.%2d',[nowdd,nowmm,nowyy]),' ','0');
> end;
> end;
> end;
>
>
>
--
Wolfgang