Subject Re: [IBO] PreventScrolling
Author Geoff Worboys
> > You may be able to use the OnGetCanScroll handler of the dataset.
> >
>
> How can I use this event, I tried the following, but it doesn't
work:

You want to set CanScroll according to whether you wish to allow
scrolling in a particular situation. This your instance, when the
main dataset is readonly (or whatever). Being an event handler you do
NOT need to call inherited.

Presuming that CTCSQuery was the lookup dataset I think you need
something like...

procedure TContactsDataModule.CTCSQueryGetCanScroll(Sender:
TIB_Dataset;
var CanScroll: Boolean);
begin
// if the sender is a lookup dataset, only allow the sender to
// scroll if the key/main dataset is not readonly.
if (Sender.KeyDataset <> nil) then
CanScroll:= not Sender.KeyDataset.ReadOnly;
end;



HTH

Geoff Worboys
Telesis Computing