Subject Re: [IBO] TIB_Grid InPlaceEditor Logic
Author Russell Belding
Hello Geoff

Thank your for your reply.

Removing the change I made and replacing UpdateContents with your
replacement procedure allows both Date editors to appear. Then inserting
MyField=EDIT in edit links causes my OnEditButton event handler to be called
when the edit button is clicked in that field. And it does not appear for
another date field. So, with your change there is control per field whereas
with my change there is not.

However with your change the OnEditButton handler is called over and over
again, requiring a forced exit. I looked through the change you made but do
not see the problem. The looping logic must be partly outside
UpdateContents?

Regards

Russell

"Geoff Worboys" <geoff@...> wrote in message
news:1424503546.20020105103139@......
> > The modified logic works for my purpose. Is it the best way to
> > handle the topic?
>
> I am not entirely happy with it, since EditLinksAuto is not guaranteed
> 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
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>