Subject Re: [IBO] TIB_Connection: error msg displayed upon cancel
Author Raymond Kennington
Thanks for your suggestions.

What's the point of having a Cancel button if it makes no difference as to whether a
connection will be attempted or not?

So are there separate exceptions for:

Cancelled Dialog Box
Clicked OK, but
FB not installed
FB Installed, but wrong username/password combination?

Normally I would do the following:

with DialogBox do
begin
if not (ShowModal() = mrOk) then
begin
Exit;
end;

try
Login(Username, password)
except
on E: Exception do
...
end;
end;

Now it is to become:

try
Connect(); // Hopefully no message appears within Connect(),
// but I suspect it will.
except
on E: Exception do
case Cancel: // do nothing
case not connected: Msg('FB not connected')
case bad user/logon: Mst('Please try again')
end;

Is this what is done?

Raymond Kennington

Norman Dunbar wrote:
>
> Hi Raymond,
>
> I have exactly the same 'problem' as this with some Oracle access components
> I use in my real job. If the user decides to cancel a login then they get a
> 'User aborted' message.
>
> I also consider it to be normal behaiviour and quite acceptable. However, I
> can, if I wish, code an exception handler and filter it out if I choose to
> do so.
>
> As Nando mentioned, the action being attempted is setting connected to true.
> This has not happened - because of the user's actions - and so it has
> failed. The failure has raised an exception, but withing the context of the
> component not in the context of your application. This is then passed back
> to your app to handle or ignore accordingly. As with all exceptions the
> developer chooses how to handle it - s/he can ignore it or display a
> message. In this case, the default action is to display it.
>
> Try catching it and simply ignoring it. I'd advise you to filter out the
> cancelled login exception and still display any others just in case you hit
> something a bit different like "Oops, the user forgot to start his
> Firebird/Interbase server" - I've done that myself too many times!
>
> Regards,
> Norman.
>
> -------------------------------------
> Norman Dunbar
> Database/Unix administrator
> Lynx Financial Systems Ltd.
> mailto:Norman.Dunbar@...
> Tel: 0113 289 6265
> Fax: 0113 289 3146
> URL: http://www.Lynx-FS.com
> -------------------------------------
>
> -----Original Message-----
> From: Raymond Kennington [mailto:raymondk@...]
> Sent: Monday, August 12, 2002 4:34 PM
> To: IBObjects@yahoogroups.com
> Subject: Re: [IBO] TIB_Connection: error msg displayed upon cancel
>
> Why have a message box with Ok/Cancel if cancelling the logon is going to
> bring up an
> Error message?
>
> I was so surprised that I actually was startled by the white cross on a red
> background:
> What could be wrong?
>
> Connected would only be attempted if I choose Ok, for then a username and a
> password would
> have been entered and the user (the developer in the IDE in this case) would
> want to
> attempt to set it to true.
>
> An attempt to set Connected to True should only occur if I press Ok and no
> attempt should
> be made to Connect if I choose to cancel the option.
>
> Raymond Kennington
>
> This email is intended only for the use of the addressees named above and
> may be confidential or legally privileged. If you are not an addressee you
> must not read it and must not use any information contained in it, nor copy
> it, nor inform any person other than Lynx Financial Systems or the
> addressees of its existence or contents. If you have received this email
> and are not a named addressee, please delete it and notify the Lynx
> Financial Systems IT Department on 0113 2892990.
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/