mIRC Homepage
Posted By: bamaboy1217 Small Suggestion With Dialogs - 26/06/05 04:59 PM
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
Posted By: tidy_trax Re: Small Suggestion With Dialogs - 26/06/05 08:27 PM
For now you can use the following
on *:dialog:*:edit:*:{
  var %text
  if ($regsub($did($did),/\D+/g,,%text)) { did -ra $dname $did %text }
Posted By: bamaboy1217 Re: Small Suggestion With Dialogs - 27/06/05 04:13 AM
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.

However that does work for now...
Posted By: qwerty Re: Small Suggestion With Dialogs - 27/06/05 10:24 AM
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 smile
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 }

Oh and of course, I too would like this built-in.
© mIRC Discussion Forums