Subject | RE: [IBO] TIB_Connection: error msg displayed upon cancel |
---|---|
Author | Norman Dunbar |
Post date | 2002-08-13T07:42:21Z |
Morning Raymond,
OK, I had a look in the source code for a login and found a quick change
that can be made. I don't know if you have access to the source code but
maybe you have enough to try the following :
in the file IBA_Connection.imp find the procedute TIB_Connection.SysLogin
and just before the final 'end' you will find these lines :
if not Connected then
DoLoginFailure;
Change them to read as follows :
if not Connected then
if LoginAborted then
Abort
else
DoLoginFailure;
Now if the user click Cancel, LoginAborted is set true and the procedure
Aborts (which doesn't raise an exception) but if it is any other failure,
the current processing is carried out - an exception is raised (Login
Failed).
Hope this helps.
I've tested the changes on D5 and D6 (personal) and it all seems to work
just fine.
I've submitted the changes to Jason for possible inclusion in a subsequent
release of IBO, so if you don't have the source code, you'll be able to get
the changes in a later upgrade - if Jason decided he wants the changes made
that is.
Regards,
Norman.
PS. Have you checked out the event OnLoginFailure for the IB_Connection - it
might be of some use. From the Help file :
Description
This event is triggered when the user fails all attempts to log in.
It is fired not at each failed attempt but only upon an ultimate failure.
Norm.
-------------------------------------
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 5:15 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] TIB_Connection: error msg displayed upon cancel
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:
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/
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.
OK, I had a look in the source code for a login and found a quick change
that can be made. I don't know if you have access to the source code but
maybe you have enough to try the following :
in the file IBA_Connection.imp find the procedute TIB_Connection.SysLogin
and just before the final 'end' you will find these lines :
if not Connected then
DoLoginFailure;
Change them to read as follows :
if not Connected then
if LoginAborted then
Abort
else
DoLoginFailure;
Now if the user click Cancel, LoginAborted is set true and the procedure
Aborts (which doesn't raise an exception) but if it is any other failure,
the current processing is carried out - an exception is raised (Login
Failed).
Hope this helps.
I've tested the changes on D5 and D6 (personal) and it all seems to work
just fine.
I've submitted the changes to Jason for possible inclusion in a subsequent
release of IBO, so if you don't have the source code, you'll be able to get
the changes in a later upgrade - if Jason decided he wants the changes made
that is.
Regards,
Norman.
PS. Have you checked out the event OnLoginFailure for the IB_Connection - it
might be of some use. From the Help file :
Description
This event is triggered when the user fails all attempts to log in.
It is fired not at each failed attempt but only upon an ultimate failure.
Norm.
-------------------------------------
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 5:15 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] TIB_Connection: error msg displayed upon cancel
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:
>components
> Hi Raymond,
>
> I have exactly the same 'problem' as this with some Oracle access
> I use in my real job. If the user decides to cancel a login then they geta
> 'User aborted' message.I
>
> I also consider it to be normal behaiviour and quite acceptable. However,
> can, if I wish, code an exception handler and filter it out if I choose totrue.
> do so.
>
> As Nando mentioned, the action being attempted is setting connected to
> This has not happened - because of the user's actions - and so it hasthe
> failed. The failure has raised an exception, but withing the context of
> component not in the context of your application. This is then passed backhit
> 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
> something a bit different like "Oops, the user forgot to start hisred
> 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
> background:a
> What could be wrong?
>
> Connected would only be attempted if I choose Ok, for then a username and
> password wouldwould
> have been entered and the user (the developer in the IDE in this case)
> want toyou
> 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
> must not read it and must not use any information contained in it, norcopy
> 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 orInterBase
> without the need for BDE, ODBC or any other layer.___________________________________________________________________________
>
> http://www.ibobjects.com - your IBO community resource for Tech Infopapers,
> keyword-searchable FAQ, community code contributions and more !___________________________________________________________________________
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
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/
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.