Vincent,
thanks for your answer. i'm a bit uncomfortable with using EditMask though, since using it would require sacrificing of format of the editbox.
scimondo,
thank you too. actually i've already tried the OnKeyPress event of lazarus before posting the question. the event contains a variable named Key, which is of character type. it absorbs the character being pressed by the user. however, lazarus treats Key and the character added in the textbox to be somewhat independent.
it means that upon keypress, the variable Key recieves the same character. we can then add conditions so that Key would become empty if the key pressed is not numeric. thus, Key remains numeric. but then again Key is not what is entered in the Keypress. no matter how you code it to chop off non-numeric variables will not matter, for the character added to the textbox is not the value of the key, but the actual character as pressed!
thus, the OnKeyPress of the editbox gives at least two outputs.
1. the character added to the textbox.
2. the Key character, which absorbs the same as that pressed, but can be edited to contain only numeric entries.
what we need to edit is the first item, as it is the one seen by the user. how do we do that?