Mimics regular Windows popups using picture windows in mIRC. Serves as a simple alternative to using a DLL like Saturn's spopups.dll.
The width of the popup is to some extend dynamic. It will be the width of the widest entry in the popup menu, thought between 50 and 250. Features not yet included but which would be nice to have at some point: Submenus, disabled text, dividers.
picm <add|show|close> [entry:command]
You can see an example of the usage in the code below.
Download: picm.mrc
alias picm.example { picm add First entry:echo -a moo picm add Another one:echo -a foo picm add Just ONE more!:echo -a bar picm show } alias picm { if ($1 == add) { hadd -m picm $calc($hget(picm,0).item +1) $2- var %v = $width($gettok($2-,1,58),Tahoma,11) if (!%picm.width || %v > %picm.width) { set %picm.width %v } } elseif ($1 == show) { if ($hget(picm,0).item) { if ($window(@picm)) { window -c @picm } if (%picm.width > 250) { set %picm.width 250 } elseif (%picm.width < 50) { set %picm.width 50 } var %w = $calc(%picm.width +16) window -dBapw0 +dL @picm $mouse.dx $mouse.dy %w $calc(($hget(picm,0).item *20) +6) picm.mouse 1 1 } } elseif ($1 == close) { window -c @picm hfree picm unset %picm.width .timerpicm off } } alias -l picm.mouse { if ($timer(picm)) { .timerpicm off } clear -n @picm var %i = $hget(picm,0).item drawfill -nr @picm $rgb(212,208,200) $rgb(212,208,200) 1 1 drawline -nr @picm $rgb(255,255,255) 1 1 $calc((%i *20)+3) 1 1 $calc(%picm.width +15) 1 drawline -nr @picm $rgb(128,128,128) 1 2 $calc((%i *20)+4) $calc(%picm.width +14) $calc((%i *20)+4) $calc(%picm.width +14) 1 drawline -nr @picm $rgb(64,64,64) 1 1 $calc((%i *20)+5) $calc(%picm.width +15) $calc((%i *20)+5) $calc(%picm.width +15) 0 if ($2 isnum $+(3-,$calc(%i *20 +2))) drawrect -fnr @picm $rgb(10,36,106) 1 3 $calc($2 - (($2 -3) % 20)) $calc(%picm.width +10) 20 var %x = 1, %y = %i while (%x <= %y) { drawtext -rcn @picm $iif($inrect($1,$2,0,$calc((%x * 20 +3)-20) && $2 > 2,$calc(%picm.width +16),20) ,$rgb(255,255,255),$rgb(0,0,0)) Tahoma 11 7 $calc(((%x *20)-20)+6) %picm.width 20 $gettok($hget(picm,%x),1,58) inc %x } drawdot @picm } alias -l picm.select { var %x = 1, %y = $hget(picm,0).item while (%x <= %y) { if ($inrect($1,$2,0,$calc((%x *20)-20),$calc(%picm.width +10),20)) { $gettok($hget(picm,%x),2-,58) | break } inc %x } picm close } menu @picm { mouse:picm.mouse $mouse.x $mouse.y sclick:picm.select $mouse.x $mouse.y rclick:picm.select $mouse.x $mouse.y leave:.timerpicm 1 1 picm close }