On Tuesday 18 October 2016 12:47:07 mohamed hamza wrote:
> Hi Martin,
>
> I noticed then OnStateChange is called 2 times when we change
> datasource.dataset.
>
> ex:
> If <cond> then dso.dataset:=dssql1.dataset else
> dso.dataset:=dssql2.dataset
>
> 1/ The first time dso.dataset become nil and the second time it is
> assigned with new value ?
It seems so:
"
procedure TDatasource.SetDataSet(ADataSet: TDataSet);
begin
If FDataset<>Nil Then
Begin
FDataset.UnRegisterDataSource(Self);
FDataSet:=nil;
ProcessEvent(deUpdateState,0); <<<<-- fires OnStateChange the first time
End;
If ADataset<>Nil Then
begin
ADataset.RegisterDatasource(Self);
FDataSet:=ADataset;
ProcessEvent(deUpdateState,0);<<<<-- fires OnStateChange a second time
End;
end;
"
> 2/ Is it possible to have last value of
> dso.dataset before it becomes nil
I don't think so.
> or do I have to init new var with
> dso.dataset before onStateChange is fired?
>
Probably.
Martin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk