Subject RE: [IBO] TIB_Script macros
Author Don Schoeman
Hi Geoff,

That is more or less what I thought Jason wanted. Thanks for clearing this
up. I'm going to keep the default macro begin and end values to '<' and '>'
respectively so that it doesn't break existing code for anyone who used the
standard values.

Thanks again for you help,

Best Regards,
Don


-----Original Message-----
From: Geoff Worboys [mailto:geoff@...]
Sent: 23 July 2001 10:35
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] TIB_Script macros


> If you are currently to busy to help me, are there any
> other IBO guru's I can plague with stupid questions like
> the ones above?

Not sure if I know exactly what Jason is looking for but since I
already use macros at the statement level (to expand various filters
etc) this is my understanding of how it should work. Note: This is
with just a few minutes thought, keep in mind that this is not tested
and can could contain holes :-)


TIB_Connection will have two properties (which dont currently exist,
but you are about to introduce); MacroBegin and MacroEnd.

These are to be string properties defaulting to '<' and '>' or '[' and
']' (please let me know which because my current app will need
changing! (By default I mean that the values are not stored when not
changed at designtime.)


There are a few different ways to implement things at the
TIB_Statement and TIB_Script level. I suggest...

Setup the statement/script level properties so that they only store
the MacroBegin/MacroEnd values when different to the connection, and
so that they use get/set functions. eg.

property MacroBegin: string read GetMacroBegin write SetMacroBegin
stored IsMacroBeginStored;

function TIB_Statement.GetMacroBegin: string;
begin
if assigned(IB_Connection) then
begin
if FMacroBegin = '' then
Result := IB_Connection.MacroBegin
else
Result := FMacroBegin;
end
else
Result := FMacroBegin;
end;

procedure TIB_Statement.SetMacroBegin( AVal: string );
begin
if AVal <> MacroBegin then
begin
if assigned(IB_Connection) then
begin
if AVal = IB_Connection then
FMacroBegin := ''
else
FMacroBegin := AVal;
end
else
FMacroBegin := FMacroBegin;
end;
end;

function TIB_Statement.IsMacroBeginStored: boolean;
begin
Result := (FMacroBegin <> '');
if Result and assigned(IB_Connection) then
begin
Result := (FMacroBegin <> IB_Connection.MacroBegin)
end;
end;


I think this should work, and it has the advantage of not impacting
other areas of the IBO code (although you may want to do a search for
the use of FMacroBegin and FMacroEnd to be sure they are not used
outside the property access functions).


Geoff Worboys
Telesis Computing




Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/