Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SpinEdit Exception 2

Status
Not open for further replies.

pmravdin

Programmer
Jul 10, 2002
9
US
The SpinEdit control allows me to get the input of an integer value. You can change the value by using the up/down thing to the right. I am also leaving it enabled the user can directly type in an integer. I have a routine that checks to see that it is an integer that has been entered and resets the number and gives a message informing the user that only integer values should be entered.

The problem:
If the user highlights the entire number in the SpinEdit and then types in a number it sometimes crashes. If it were as simple as just thinking it was non-integer (and it seems to be giving that type of error) it should be caught by my exception handling routine for this. More perplexing yet, it seems to do this intermittently, in that for reasons that I can not discern sometimes the machine seems to be in a state where this does not happen. It is as if sometimes when one has highlighted the entire old number and starts typing in a new number the control is confused as to its entry and sometimes thinks it is I am not sure what.

Suggestions and explanations much appreciated. I want to leave the control enabled so either the SpinEdit can be used or direct integer data entry.
 
The problem occurs when you have an event hooked to the SpinEdit's OnChange event, and that event reads the SpinEdit's value. As you say, the SpinEdit tries to convert '' to an integer, and then gets upset because '' is not a valid integer value.

It's not being caught by your exception handler because your exception handler is at a higher level -- to catch the error, you'd need to put the exception handler into the VCL source for the SpinEdit control.

You can avoid the problem by using a different SpinEdit control -- for example, TJvSpinEdit from Jedi, at -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top