Subject TIB_DataSet and PropertyEditor !! Need Help
Author Rade Vojvodic
Dear all,

I want to write some property editor that is using TIB_DataSet. It should
populate treeview with field names of TIB_Dataset. The code looks like this.
It works for TDataset but not for TIB_Dataset. FieldCount Property is
allways 0 at designtime as well as Fields.ColumnCount. How can I resolve
this problem. I just need Number of fields and their names at design time.


for i:=0 to aDataModule.ComponentCount-1 do
begin
if (aDataModule.Components[i]is TDataSet) then
begin
Ds:=aDataModule.Components[i] as TDataSet;
CurrItem:=edFields.Items.AddChild(Root, Ds.Name);
CurrItem.ImageIndex:=0;
CurrItem.SelectedIndex:=0;
CurrItem.Data:=nil;

Child:= edFields.Items.AddChild(CurrItem, FullDataSetStr);
Child.ImageIndex:=1;
Child.SelectedIndex:=1;
Child.Data:=nil;
for k:=0 to Ds.FieldCount-1 do
begin
Child:= edFields.Items.AddChild(CurrItem, Ds.Fields[k].FieldName);
Child.ImageIndex:=1;
Child.SelectedIndex:=1;
Child.Data:=Ds.Fields[k];
end
end else
if (aDataModule.Components[i]is TIB_DataSet) then
begin
//Ds:=aDataModule.Components[i] as TIB_DataSet;
CurrItem:=edFields.Items.AddChild(Root,
(aDataModule.Components[i] as
TIB_Dataset).Name);
CurrItem.ImageIndex:=0;
CurrItem.SelectedIndex:=0;
CurrItem.Data:=nil;

Child:= edFields.Items.AddChild(CurrItem, FullDataSetStr);
Child.ImageIndex:=1;
Child.SelectedIndex:=1;
Child.Data:=nil;
for k:=0 to (aDataModule.Components[i] as TIB_Dataset).FieldCount-1 do
begin
Child:= edFields.Items.AddChild(CurrItem,
(aDataModule.Components[i] as
TIB_Dataset).Fields[k].FieldName);
Child.ImageIndex:=1;
Child.SelectedIndex:=1;
Child.Data:=(aDataModule.Components[i] as
TIB_Dataset).Fields.Columns[k];
end;
end else

Rade Vojvodic
MIS
Development and Employment Foundation
Republika Srpska