Subject | Re: [IBO] TIB_Grid InPlaceEditor Logic |
---|---|
Author | Geoff Worboys |
Post date | 2002-01-04T23:31:39Z |
> The modified logic works for my purpose. Is it the best way toI am not entirely happy with it, since EditLinksAuto is not guaranteed
> handle the topic?
to be true. You really need some other way of preventing the built in
date editor from being displayed.
I noticed in the grid code that it is possible to force the date
editor to appear by providing an EditLink entry of...
MYFIELD=DATE
(and this will happen even if you DONT have a FIELD=NOTIME entry in
the column attributes).
That capability is made to function via:
procedure TIB_GridInplaceEdit.UpdateContents;
The way the code is at the moment an IsDateOnly field is overrides the
detection of EditLinks entries and always shows the default date
editor. What I would like to do is alter that procedure so that...
procedure TIB_GridInplaceEdit.UpdateContents;
var
NewColor: TColor;
tmpIdx: integer;
tmpStr: string;
begin
if Modified then
if not TIB_CustomGrid(Grid).FIB_DataLink.DataChanging then
TIB_CustomGrid(Grid).SysUpdateData( nil );
with TIB_CustomGrid(Grid) do
begin
NewColor := Color;
Self.Font := Font;
GetCellProps( Col, Row, [gdFocused], NewColor, Self.Font );
Self.Color := NewColor;
tmpIdx := EditLinks.LinkIndex[ SelectedField.BestFieldName ];
if tmpIdx <> -1 then
begin
tmpStr := Trim( AnsiUpperCase( EditLinks.IndexValues[ tmpIdx ] ));
if ( Length( tmpStr ) > 0 ) and ( tmpStr[1] = 'D' ) then
EditStyle := esDate
else
EditStyle := esEdit;
end
else
begin
if SelectedField.IsDateTime and
not SelectedField.ControlsReadOnly and
SelectedField.IsDateOnly then
EditStyle := esDate
else
begin
if SelectedField.IsBlob then
begin
// if we want to edit links for text blobs...
if EditLinksAuto and SelectedField.IsText then
EditStyle := esEdit
else
EditStyle := esNormal;
Self.ReadOnly := true; // prevent blob from being edited on grid
end
else
EditStyle := esNormal;
end;
end;
PostMessage( Self.Handle, WM_USER, Col, Row );
end;
inherited UpdateContents;
end;
The above change makes it so that you can override the "EditStyle" by
explicit declaration of an EditLinks entry similar to
MYFIELD=EDIT
and so force the built in date editor to be disabled.
Russell can you try the above (after removing your prior change) and
see if it works as I describe.
--
Geoff Worboys
Telesis Computing