Subject Re: [IBO] TIBOQuery: OnSetText and OngetText not firing?
Author Daniel Rail
Hi,

At May 9, 2006, 6:06 PM, John vd Waeter wrote:

> Jason Wharton wrote:
>> You should use the DisplayText property instead of AsString if you want
>> these events to work.

> I'd love to, but how? This property is just a read-only string. How
> would I have to use it to make OnGetText/OnSetText work?

It's a parameter of the OnGetText event. And, for the OnGetText, you
should be assigning to the "Text" parameter. And, for the OnSetText,
use the Sender parameter to assign the the field.

Here's what your OnSetText event should look like:

procedure Scramble(Sender: TField; const Text: String);
begin
Sender.AsString:=Encrypt(Text);
end;

And, your OnGetText should look like:

procedure DeScramble(Sender: TField; var Text: String; DisplayText:
Boolean);
begin
Text:=Encrypt(Sender.AsString);
DisplayText:=False;{This permits editing the string value}
end;


--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)