I never understood why number wasnt an edit box option so that the editbox had the ES_NUMBER style and was only limited to number entries
This would not be a hard thing to add have i just missed it over the years? if not i definitly think ti should be added as a style for obvious reasons it is very helpful...
and i know it can be done with a dll but it shouldnt have to be... not this at least
ya for now... hopefully though khaled will add it in a future release seeing as how it would be an incrediably simple addition to edit controls and would provide a slight performance increase i would think over the example you provided since it would b ebuilt into windows and not a scripted reg ex thing.
I use this, so that the cursor position isn't reset. This makes it behave almost the same as a true numbers-only box, giving the effect that non-numeric keypresses are just halted. It also works if you paste text, triggering successive events
Code:
on *:dialog:<name>:edit:<id>: num-edit $dname $did
alias num-edit {
var %a = $did($1,$2), %s = $did($1,$2,1).selstart
if $mid(%a,%s,1) !isnum { did -ra $1-2 $remove(%a,$v1) | did -c $1-2 1 %s }
}