Subject | Re: [IBO] Datasource state aware button |
---|---|
Author | Nando Dessena |
Post date | 2001-03-08T12:39:04Z |
Hi Marc,
just suggesting it be a DataSource. You can have two DataSource
components linked to the same dataset, one in the datamodule (if there's
the need) and one on the form. Personally, I often put datasource
components on the forms and only occasionally *also* in the datamodules
(depending on the role of the datasource objects: user interface or
dataset correlation).
here is a DataSource. It may be a case of personal preference, though.
reduce the need for additional code.
Ciao
--
____
_/\/ando
> My Datasource is in the main datamodule and of course I could set a handlerI agree absolutely. You definitely need an additional components, I was
> there and add chek to see if the main form is created and deal with it
> there, but I don't beleive this code belongs there
just suggesting it be a DataSource. You can have two DataSource
components linked to the same dataset, one in the datamodule (if there's
the need) and one on the form. Personally, I often put datasource
components on the forms and only occasionally *also* in the datamodules
(depending on the role of the datasource objects: user interface or
dataset correlation).
> So in my main form I have the following (remember the mainform diaplay isI still can't see the need for a DataSourceEvents proxy; all you need
> read-only)
>
> procedure TfrmCDSMain.IB_DataSourceEvents1DataChange(Sender: TIB_DataLink;
> ADataSource: TIB_DataSource; AField: TIB_Column);
> begin
> inherited;
> if ( AField = nil ) then { browsing (should always be true in my case)}
> begin
> SetLinkedButtonState(ADataSource);
> end;
> end;
here is a DataSource. It may be a case of personal preference, though.
> procedure TfrmCDSMain.PageControlLinksChange(Sender: TObject);you may want to consider keeping one datasource and switch datasets to
> begin
> inherited;
> with PageControlLinks do
> case ActivePage.Tag of
> 1 : IB_DataSourceEvents1.DataSource := DM.IB_DSRequest;
> 2 : IB_DataSourceEvents1.DataSource := nil;
> 3 : IB_DataSourceEvents1.DataSource := DM.IB_DSTask;
> 4 : IB_DataSourceEvents1.DataSource := nil;
> end;
> SetLinkedButtonState(IB_DataSourceEvents1.DataSource);
> SetLinkedButtonHints(IB_DataSourceEvents1.DataSource);
> end;
reduce the need for additional code.
Ciao
--
____
_/\/ando