Subject Re: [IBO] F2 to Edit
Author Andreas Pohl
Hi Geoff,

> Andreas Pohl wrote:
>> Hallo Andreas Pohl,
>
> Hi Andreas and Andreas, :-)

that's about my TB settings :)

> What version of Delphi (and IBO) are you using?

D7SP2 and IBO 4.3.Aa

> The changes are interesting but particularly that last one looks
> to have one of my comments above it. It is too long ago now
> since I installed the interface for dropped controls, I cannot
> remember all the various issues that occurred, but there were
> LOTS of them. Unless a more recent release of Delphi has made
> some of the boundschanged calls redundant I suspect the changes
> you suggest are not safe for all cases.

That could be true. But without that I could not change
TIB_Grid.InpaceEdit (SetBounds, color etc.) depending on selected column.

1. ShowEditor results a call to BoundsChanged and this causes a
permanent flickering when I tried to hookup to BoundsChanged event and
to overwrite standard settings of TInplaceEdit.

2. It was not possible to work with TIB_Datasource.AutoEdit in a manner
that a user is expecting: Highlight/Select of a cell and start typing
should overwrite cell's content. As you already mentioned with IBO's
grid you have to press F2 first or it will only append to existing
content regardless of selected parts.

For me and my environment it works without any drawbacks to existing
projects - as far as I can see ;)

FYI: I subclassed TIB_Grid, invoked an own TInplaceEdit to overwrite
BoundsChanged procedure and added an event for the grid to access
TInplaceEdit settings while runtime:

TibpInplaceEditorEvent = procedure ( sender:TObject; var Rect:TRect)
of Object;

TIBP_InplaceEdit = class(TIB_GridInplaceEdit)
protected
procedure BoundsChanged; override;
end;

TIBP_Grid = class(TIB_Grid)
FOnEditorBounds: TibpInplaceEditorEvent;
protected
{ Protected-Deklarationen }
function CreateEditor: TInplaceEdit; override;
published
property OnEditorBounds: TibpInplaceEditorEvent read FOnEditorBounds
write FOnEditorBounds;

procedure TIBP_InplaceEdit.BoundsChanged;
var ActR: TRect;
begin
inherited BoundsChanged;
ActR:=self.BoundsRect;
if assigned(TIBP_Grid(grid).OnEditorBounds) then
TIBP_Grid(grid).FOnEditorBounds(self,ActR );
end;

function TIBP_Grid.CreateEditor: TInplaceEdit;
begin
Result:=TIBP_InplaceEdit.Create(Self);
end;

I already posted a link to a screenshot to show my doings in "action".

--
Andreas