mIRC Home    About    Download    Register    News    Help

Print Thread
Dialog editbox #27556 01/06/03 10:26 PM
Joined: Mar 2003
Posts: 58
A
Adler Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Mar 2003
Posts: 58
edit "text", id, x y w h, style (right, center, multi, pass, read, return, hsbar, vsbar, autohs, autovs, limit N)

Add an Style "numonly"

There allow only numbers to write down

-------------------------------------------------------------
If a dialog -dm an option for minimize to tray

Re: Dialog editbox #27557 01/06/03 11:29 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Agreed, this needs to be built-in imo. Meanwhile, you may find this useful, I wrote it exactly for this purpose:
Code:
[color:green]; Usage: /numonly <dialogname> <id> <max number>[/color]
alias numonly {
  var %a = $did($1,$2), %s = $did($1,$2,1).selstart
  if $mid(%a,%s,1) !isnum { did -ra $1-2 $remove(%a,$ifmatch) | did -c $1-2 1 %s }
  if $did($1,$2) > $3 { did -ra $1-3 | did -c $1-2 1 -1 }
}


You should use it with your on EDIT event. Here's an example dialog named "SomeDialog" with an editbox with ID 4 that should only accept numbers up to 500:
Code:
on *:dialog:SomeDialog:edit:4: numonly $dname $did 500


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com