ZConnection. AllowStreamed Connected property

samayoa writes “I have found that such property of IBX’s IBDatabase is very useful. I often have some code at main form’s FormCreate event which gets (via user intervention, INI reading, registry reading, etc.) to which database user want to connect. Without this property, Connected must be set to false before compile and run. Zeos’s ZConnection component lacks this property and it is very easy to implement (code bellow).


In ZConnection.pas:

At the protected section add:

FAllowStreamedConnected: Boolean;

At published section add:

property AllowStreamedConnected : Boolean read FAllowStreamedConnected write FAllowStreamedConnected default true;

Change the following line at Loaded method from:
if FStreamedConnected then SetConnected(True);

to:
if FStreamedConnected and FAllowStreamedConnected then SetConnected(True);

Recompile and reinstall ZComponent.dpk

Thats it.

Posted in Code Hacks | Leave a comment