ArianeSoft Forums

ArianeSoft Forums (http://forums.arianesoft.ca//index.php)
-   Support (http://forums.arianesoft.ca//forumdisplay.php?f=19)
-   -   How to make a numeric edit input (http://forums.arianesoft.ca//showthread.php?t=1932)

rik 01-04-2010 03:10 PM

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-04-2010 11:15 PM

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:
PHP Code:

text$=Edit1.text;
length$=length(text$);
lastchar$=chr(text$[length$-1]);
if(
isdigit(lastchar$)==False)
 
Edit1.text=mid(text$,0length$-);
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.

rik 01-05-2010 07:24 AM

Tkank You very much.

I'll try it.

Giuseppe

kornalius 01-05-2010 05: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 07:22 PM

that is even a better solution, have overlooked this editbox style :o

Kobus 01-05-2010 10: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 12:26 PM

Re: How to make a numeric edit input
 
True that. Nicknack is amazing! Thank god he is around.

Nicknack 01-07-2010 08:24 PM

I'm feeling very grateful, but I don't do it selfless, I get always get something back from you :)

rik 01-25-2010 11:29 AM

Quote:

Originally Posted by kornalius (Post 12333)
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 07: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.


All times are GMT. The time now is 09:01 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (c) ArianeSoft Inc.