Subject Re: [IBO] How open a dataset with only a Bookmark record?
Author Marco Menardi
I've found the problem, you don't have to use the syntax:
with (FBaseDataSource.DataSet as TIB_Protected_BDataset) do
but
with TIB_Protected_BDataset(FBaseDataSource.DataSet) do


This is the standard method for accessing protected members of a
class, i.e. define a fake class and then cast the class to that.
like in this sample:
type
THackedControl = class (TControl);

procedure TForm1.DoSomethingCrazy;
var
AControl : TControl;
begin
AControl:=Label1;
{cast control to THackedControl so you can acces the protected
properties}
THackedControl(AControl).Color:=clRed;
THackedControl(AControl).Font.Color:=clWhite;
end;

Anyway, that does not solve the problem, since puts the Bookmark value
in Fields, while I have to go into SearchBuffer, and there is not
something like:
SearchBufferKeyFields.RowData := LocateBookmark;
unfortunatly... :(

thanks
Marco Menardi

--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 01:52 PM 16/03/2003 +0000, you wrote:
[cut]
> >I'm trying to use a protected method: SetBufferBookmark(bookmark)
> >I don't know if it's the right direction, but I've got a strange error
> >(ok, it's not IBO related, but...)
> >// just to access protected methods
> >TIB_Protected_BDataset = class(TIB_BDataset);
> >
> >// this works as expected...
> > with (FBaseDataSource.DataSet as TIB_BDataset) do
> >
> >// this raises an "Invalid Class TypeCast"
> > with (FBaseDataSource.DataSet as TIB_Protected_BDataset) do
> >
> >D6, SP3.
> >really s trange, isn't it?
>
> No, it's not strange. If FBaseDataSource.DataSet is pointing to a
> TIB_Query. TIB_Protected_BDataset won't be in TIB_Query's ancestry,
will it?
>