Subject | Re[2]: [IBO] Saving and loading queries FieldIndex and FieldDisplayWidth values |
---|---|
Author | Ramil |
Post date | 2007-07-31T07:04:08Z |
Hello Elmar Knoerzer,
If you make descendant of TIB_Query, make it carefully.
Call inherited doBeforeOpen in your new doBeforeOpen.
Do you really want do it before open / after close?
I suggest do it on create and destroy.
You can do it on DataModule create and destroy
for all your datasets.
For ex. I can load some values from XML-tree:
...
with FIB_Connection.Owner do
for i:=0 to Pred(ComponentCount) do
begin
if Components[i] is TIB_Query then
begin
qr:=Components[i] as TIB_Query;
DSNode:=ChNode.ChildNodes.FindNode(qr.Name);
if Assigned(DSNode) then
begin
with qr do
begin
BeginLayout;
try
FieldsDisplayWidth.Text:=DSNode.Attributes['FieldsDisplayWidth'];
FieldsVisible.Text:=DSNode.Attributes['FieldsVisible'];
FieldsIndex.Text:=DSNode.Attributes['FieldsIndex'];
DefaultValues.Text:=DSNode.Attributes['DefaultValues'];
OrderingItemNo:=DSNode.Attributes['OrderingItemNo'];
finally
EndLayout;
end;
end;
end;
end;
end;
...
--
Best regards,
Ramil R. Khabibullin khabibr@...
If you make descendant of TIB_Query, make it carefully.
Call inherited doBeforeOpen in your new doBeforeOpen.
Do you really want do it before open / after close?
I suggest do it on create and destroy.
You can do it on DataModule create and destroy
for all your datasets.
For ex. I can load some values from XML-tree:
...
with FIB_Connection.Owner do
for i:=0 to Pred(ComponentCount) do
begin
if Components[i] is TIB_Query then
begin
qr:=Components[i] as TIB_Query;
DSNode:=ChNode.ChildNodes.FindNode(qr.Name);
if Assigned(DSNode) then
begin
with qr do
begin
BeginLayout;
try
FieldsDisplayWidth.Text:=DSNode.Attributes['FieldsDisplayWidth'];
FieldsVisible.Text:=DSNode.Attributes['FieldsVisible'];
FieldsIndex.Text:=DSNode.Attributes['FieldsIndex'];
DefaultValues.Text:=DSNode.Attributes['DefaultValues'];
OrderingItemNo:=DSNode.Attributes['OrderingItemNo'];
finally
EndLayout;
end;
end;
end;
end;
end;
...
--
Best regards,
Ramil R. Khabibullin khabibr@...
>
>
>
>
>
> Hallo Andreas,
>
> it's a good idea. But if i try to override doBeforeOpen in my
> descendant of ib_query, i get an invalid statement handle.
>
> Could you give me a short snippet, where i have to hook in?
>
> Regards Elmar
>
> --- In IBObjects@yahoogroups.com, Andreas Pohl <apohl@...> wrote:
>>
>> Hallo Elmar Knoerzer,
>>
>> > Hi,
>> > it's easy to save and load queries FieldIndex and FieldDisplayWidth
>> > values with commatext.
>> >
>> > Now i like to make a descendant of TIB_Query to do this automatically.
>>
>> take a look to DoBeforeOpen() and DoBeforeClose() of TIB_Query;
>>
>> I subclassed TIB_Query and TIB_Connection and introduced events
>> TIBP_Connection.OnBeforeIBPQueryOpen and
>> TIBP_Connection.OnBeforeIBPQueryClose to load and save settings.
>>
>> HTH.
>>
>> --
>> Andreas
>>
>
>
>
>
>
> __________ NOD32 2429 (20070730) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>