dialog test {
title "mIRC"
size -1 -1 110 100
option dbu
list 1, 15 34 80 48
edit "", 2, 15 22 80 10, autohs
button "Rem", 5, 40 82 30 10
}
on *:dialog:test:init:*: {
;Add some words
did -a $dname 1 Some
did -a $dname 1 Other
did -a $dname 1 Help
did -a $dname 1 Word
}
on *:dialog:test:sclick:*: {
;case 1 - Button: remove a selected word in the listbox - select word AND press Rem
if ($did == 5) {
did -d $dname 1 $did($dname,1).sel
}
}
on *:dialog:test:edit:*: {
;case 2 - Edit : type some word in the edit, some word that exists in the ListBox
if ($did == 2) {
if $_found($dname,1,$did($did)) {
did -c $dname 1 $ifmatch
did -d $dname 1 $did($dname,1).sel
did -r $dname 2
}
}
}
alias _found {
var %f = $did($1,$2).lines
while (%f >= 1) {
if ($gettok($did($1,$2,%f),1,32) == $3) return %f
dec %f
}
else return 0
}