problem with reappearing exceptions

thwein used Ask the Experts™
I wrote a program with Borland Delphi where you can
change the edit field data with upDown elements.

Following problem:
If I click on the down arrow and then the edit field value
is out of range I get an exception as wanted.
Then the old value appears again in the edit field. all OK.
Then I do this again.
Now when I click somewhere on that half of the screen that is under the upDown element, another DownClick Event is performed and I get the Exception again.
Why is the second DownClick performed?
How can I avoid this?

Following some source code.

Thanks for helping.

procedure TMainDlg._FBNumberOfPulsesExit(Sender: TObject);
// if value is out of range an EPulseNumberError is thrown
    FFullBridge.PulseNumber := StrI(_FBNumberOfPulses.Text);
    _FBNumberOfPulses.Text := IStr(FFullBridge.PulseNumber);
  except on E: EPulseNumberError do
      ModalError('Error: ' + E.Message + ' Please correct.');
  //set back to old value  
  _FBNumberOfPulses.Text := IStr(FFullBridge.PulseNumber);
  end; {try}

procedure TMainDlg._FBNumberOfPulsesUpDownClick(Sender: TObject;
  Button: TUDBtnType);
  case Button of
    btNext: _FBNumberOfPulses.Text := FStr(StrF(_FBNumberOfPulses.Text) +
    btPrev: _FBNumberOfPulses.Text := FStr(StrF(_FBNumberOfPulses.Text) -

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

I'll try to find out also. I think it is a bug from the SpinButton. I was using them in one of the program and got the exact same problem, and sometimes, I got the DownClick more than once when clicking beside the spin... Very anoying, as I didn't want to lose time with this I just changed the component but... weird!

As to say, I don't think you're doing something wrong!
Oh, and by the way it shows in Delphi 6&7. Just out of interest, on what component are your TUpDown placed down?


The TUpDown is placed on a TGroupBox on a TNotebook - TTabSheet -  TPageControl - TMainDlg.

Which component do you use instead of it?
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

I had placed it on a TPaintBox but now I use simple TBitBtn or TSpeedButton as I changed my GUI a bit...

This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.


Thanks for help. Sorry for being so slow.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial