Subject | Re: [IBO] How to prevent master from scrolling if detail dataset not in dssBrowse |
---|---|
Author | Christian Danner |
Post date | 2006-01-22T21:12:04Z |
Ok,
in the course of this overwhelming response I tried to find myself a
more or less flexible solution for an MDI app to block the master
datasets, callable within the OnStateChanged event of the detail
dataset:
procedure DisableMasters( Dataset : TIB_Dataset;
Form : TForm);
var
ds : TIB_DataSource;
cp : integer;
begin
ds := Dataset.MasterSource;
while Assigned( ds) do
begin
for cp := 0 to Form.ComponentCount - 1 do
begin
if Form.Components[ cp] is TIB_Grid
then
if (Form.Components[ cp] as TIB_Grid).DataSource = ds
then
(Form.Components[ cp] as TIB_Grid).Enabled :=
false; // true in EnableMasters()
{ the same for all other controls in use
(TIB_NavigationBar, TIB_UpdateBar, TIB_Edit ... }
end;
ds := ds.Dataset.MasterSource;
end;
end;
It actually works very well. But what to do with the ComboBox used to
set the OrderingItemNo? It's not data aware, so there's no DataSource
property :-(
Supposed I'm not the only one who uses a ComboBox to select orderings
that are too numerous and complex to be represented by the header
fields of an IB_Grid, would something like a 'TIB_OrderingCombo'
component be of common interest? Above all, there also would be no
more need to populate OnChange events and corresponding datasets'
OnOrderingChanged events for synchronization.
Regards
Christian
in the course of this overwhelming response I tried to find myself a
more or less flexible solution for an MDI app to block the master
datasets, callable within the OnStateChanged event of the detail
dataset:
procedure DisableMasters( Dataset : TIB_Dataset;
Form : TForm);
var
ds : TIB_DataSource;
cp : integer;
begin
ds := Dataset.MasterSource;
while Assigned( ds) do
begin
for cp := 0 to Form.ComponentCount - 1 do
begin
if Form.Components[ cp] is TIB_Grid
then
if (Form.Components[ cp] as TIB_Grid).DataSource = ds
then
(Form.Components[ cp] as TIB_Grid).Enabled :=
false; // true in EnableMasters()
{ the same for all other controls in use
(TIB_NavigationBar, TIB_UpdateBar, TIB_Edit ... }
end;
ds := ds.Dataset.MasterSource;
end;
end;
It actually works very well. But what to do with the ComboBox used to
set the OrderingItemNo? It's not data aware, so there's no DataSource
property :-(
Supposed I'm not the only one who uses a ComboBox to select orderings
that are too numerous and complex to be represented by the header
fields of an IB_Grid, would something like a 'TIB_OrderingCombo'
component be of common interest? Above all, there also would be no
more need to populate OnChange events and corresponding datasets'
OnOrderingChanged events for synchronization.
Regards
Christian