Link to home
Start Free TrialLog in
Avatar of ravicha
ravicha

asked on

Dynamically enter numeric values in Maskedit control

Hi,
I am using a Maskedit box that can accept only numeric values. The Maskedit box has got two decimal places. At runtime when i enter values , firstly the maskedit box does not right align the numbers, cuz there is not such align property for it. Secondly if the numbers are entered one by one, they remain the same on the screen and do not get formatted. Like for eg, if the mask is "___.__" and i enter "2_2.__" the lostfocus shows the same "2_2.__" even if hideselection is false.

Is there a way first to dynamically start entering numbers from the right most side of the maskedit box and second how do i backspace the numbers i.e if i delete any numerals. I have written function to convert "2_2.__" to "022.00" in the lostfocus. Any Help?
Avatar of scrapdog
scrapdog
Flag of United States of America image

Maskedit boxes are usually not very versatile...you could try to simulate your own using a regular edit box...do your validation in the change event, and update the position of the insertion point accordingly.
I agree with scrapdog..try setting up a normal text box..I personaly use the keypress event..since then you can stop invalid input. Don't for get to leave at least backspace, return and delete keycodes enabled.
ASKER CERTIFIED SOLUTION
Avatar of myqlG
myqlG

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial