Hi Vic,

When errflag is WICBADTOKENCT, your code displays the error message AND 
set the focus back to edtLatitude.  That's why btnB's OnClick event never 
get triggered.  However, your code also prevents you from tabbing out of 
edtLatitude if errflag is WICBADTOKENCT!

Anyway, you have to decide whether you want the user to correct the text 
in edtLatitude or terminate the program when the user click btnB and 
errflag is WICBADTOKENCT.

Hope this helps
Raymond



"vfraenc1" <[EMAIL PROTECTED]>
Sent by: advanced_delphi@yahoogroups.com
09/11/2007 07:25 AM

--- In advanced_delphi@yahoogroups.com, Raymond C Chow
<[EMAIL PROTECTED]> wrote:
>
> Hi Vic,
> 
> Do you have any event handler associated with txtA that prevents
btnBClick 
> from firing?  For example, if you show a message box in txtA's OnExit 
> event handler, that will prevent btnB from firing.

Raymond,

Here is the entire code for the edtLatitudeExit (edtLatitude = txtA)
exit handler. It is the only event handler associated with the text box:

procedure TfrmWIC.edtLatitudeExit(Sender: TObject);

var
  ang : double;
  errflag : integer;
  s : string;

begin
  s := edtLatitude.Text;
  errflag := ParseLatLong(ang, s);
  Case errflag of
    WICNOERROR:
      begin
        Latitude := abs(ang);
        btnNorth.SetFocus;
      end;
    WICBADTOKENCT:
      begin
        lblMessage.Caption := 'Latitude BADLY formed - Please RE-ENTER';
        edtLatitude.SetFocus;
      end;
    WICNOTNUMERIC:
      begin
        lblMessage.Caption := 'Latitude NOT numeric - Please RE-ENTER';
        edtLatitude.SetFocus;
      end;
    WICBADMINSEC:
      begin
        lblMessage.Caption := 'INVALID minute or second - Please
RE-ENTER';
      end;
  end;  //case errflag

end;

While focus is on edtLatitude and btnB is clicked, the error
associated with errflag is WICBADTOKENCT and the error message
associated with that value is displayed on the form. The btnB click
event DOES NOT fire in this case. It only fires whe I tab to the
button and then click it.

> Another possibility is that btnBClick is actually fired but certain 
> condition in your code prevents your application from terminating.

What conditions might cause this?

Vic

Reply via email to