StringGadget : #PB_String_Float

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

StringGadget : #PB_String_Float

Post by Flype »

is it possible to add a new flag for the stringgagdet

-> #PB_String_Float which will allow only 'numeric' characters and only one '.' or ','

but at this moment which is the best way to enter a float value in stringgadget ?
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Good suggestion. For the moment, i would check the EventType() 'Change' and remove the unallowed character (but it could be a bit jerky as the text will be displayed then removed). Another way is to do a post validation check.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

I do something similar for a mask but then the carat position is lost. Any way to handle that?
@}--`--,-- A rose by any other name ..
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

Yeah, and I also want it to support negative values.
The ones with '-' before the number...
I like logic, hence I dislike humans but love computers.
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

See this post. I am hoping for two additional parameters for the StringGadgetl Filters and Masks
viewtopic.php?p=58907#58907

or take a look at my Masked & Filtered Input here
http://elfecc.no-ip.info/purebasic/#MaskedInput
Post Reply