View Full Version : How to make a numeric edit input
Hi,
I would like to make a numeric edit imput box, only numeric and comma
imput allowed.
How I can do this?
Giuseppe
Nicknack
01-05-2010, 12:15 AM
Welcome Giuseppe ;)
unfortunalty there isn't a predefined way to do this, so you have to check every single input if it is a digit or not.
try the following:
1. make a new form with an editbox
2. add the event OnChange for the editbox
3. switch to code view ('view project source' icon)
4: insert this code in the OnChange function:
text$=Edit1.text;
length$=length(text$);
lastchar$=chr(text$[length$-1]);
if(isdigit(lastchar$)==False)
Edit1.text=mid(text$,0, length$-1 );
end;
now you can add another if-loop for the comma.
you can also insert this code per visual programming, but this way its a bit faster.
Tkank You very much.
I'll try it.
Giuseppe
kornalius
01-05-2010, 06:01 PM
You could also create a new component inherited from PEdit and just add ES_NUMBER to the PEdit.Create proc.
Nicknack
01-05-2010, 08:22 PM
that is even a better solution, have overlooked this editbox style :o
Kobus
01-05-2010, 11:21 PM
Heyyyyyy Nicknack,
You have a green card, remember.
All your posts are so much more than just helpfull.
When your name shows up, I immediately get a smile on my face.
Greetzzz,
Helen.
kornalius
01-06-2010, 01:26 PM
True that. Nicknack is amazing! Thank god he is around.
Nicknack
01-07-2010, 09:24 PM
I'm feeling very grateful, but I don't do it selfless, I get always get something back from you :)
You could also create a new component inherited from PEdit and just add ES_NUMBER to the PEdit.Create proc.
Pls can You post an example on how to inherit form PEdit and how to right align text?
Regards,
Giuseppe
Nicknack
01-26-2010, 08:56 PM
ES_RIGHT should be the adequate style. concerning inherting, simply inherit the PEdit class and copy/rewrite the create function to your needs. see the help file topic about classes for further info.
ES_RIGHT should be the adequate style. concerning inherting, simply inherit the PEdit class and copy/rewrite the create function to your needs. see the help file topic about classes for further info.
Thank You.
mmtbb
01-27-2010, 05:24 PM
There is an input box in ppl. I know because I wrote it. Have you you look in the Demo folder? There is a InputBoxDemo that shows how to use my InputBox. At least it is in 1.x version.
ps. It has the ability to only allow numerics as well.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.