Subject Re: [IBO] IB-Default Actions
Author Geoff Worboys
> Can anybody tell me, what I'm doing wrong ?

It looks to me like there is a bugett (baby bug :-) in the action
code.

In IB_ActionNavigate.pas you will see

procedure TIB_ActionLast.StateChanged(Sender: TIB_DataLink;
ADataSource: TIB_DataSource);
begin
Enabled := Assigned(DataSource) and
Assigned(DataSource.DataSet) and
(not ADataSource.Dataset.Eof);
end;

And of course the dataset rarely ever gets to Eof. Grids etc usually
find Eof and then go back to the last record.

If you look in IB_NavigateBar you will see that it is not trying to
use the actions directly but controls its buttons with its own
datalink. You will see where it is checks nbLast against "EofRowNum -
1" (the last valid row). Similar problems exist for ALL the
navigation actions.

So back to IB_ActionNavigate again, we need something a little more
sophisticated like...

procedure TIB_ActionLast.StateChanged(Sender: TIB_DataLink;
ADataSource: TIB_DataSource);
begin
if Assigned(DataSource) and
Assigned(DataSource.DataSet)
begin
if DataSource.Dataset is TIB_BDataset then
with DataSource.Dataset as TIB_BDataset do
begin
// Enabled when NOT sitting on the last row
Self.Enabled := not(
BufferHasEof and (RowNum = (EofRowNum - 1)) );
end
else
Enabled := (not DataSource.Dataset.Eof);
end
else
Enabled := false;
end;


HTH

Geoff Worboys
Telesis Computing