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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting cursor position

Status
Not open for further replies.

d3g3sh

Technical User
May 5, 2006
8
SK
hi, i know, this is a dummy question, but, how if i have edit1, edit2, edit3..., how can i set the mouse cursor to them, if i want it in edit5 for example, what should i write?
 

Check the methods for TEdit in the help file. You should find one that says "SetFocus"

 
ohh, am stupid, all i needed to write was EditX.setfocus, i had it before, but it didnt work because it was on wrong place...
 
another problem, how do i set that only INTEGER or REAL can be typed into EditX?
 
* and only in specific range, for example integer between '50' and '300'
 

If you are using an ordinary TEdit it is up to you to write code to verify that the data entered is valid for your purposes.

One way is to use StrToIntDef and then either report that the string is not an integer (i.e., you got the default value) or it is out of range, as the case may be.

 
Or use a TMaskEdit. They are a royal pain with some nearly untrappable exceptions showing messages in english (a very bad thing if you work in any other language), but if you are starting with Delphi, better get a hang on the more standard controls berfore moving to third party ones.

You'll gain in knowledge and mind sanity in the middle run.

buho (A).
 
thx Zathras, StrToIntDef is good :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top