;author Ecronika
;script Example to Autocomplete an editable drop down combo
;version 1.1
;public acomp
alias acomp {
;syntax /acomp
;description Opens the Auto Complete Dialog to test my code.
;returns null
dialog $iif($dialog(acomp),-v,-m acomp) acomp
}
alias -l acomp.init {
if (!$dialog(acomp)) { return }
didtok acomp 1 44 hehe,haha,test entry,something,stupid
did -f acomp 2
}
alias -l acomp.edit {
if (!$dialog(acomp)) { return }
if ($didwm(acomp,1,$+($did(acomp,2),*))) {
var %l $calc($len($did(acomp,2).text) +1)
did -o acomp 2 1 $did(acomp,1,$ifmatch)
did -c acomp 2 1 $calc($len($did(acomp,2).text) +1) %l
}
}
alias -l acomp.select {
if (!$dialog(acomp)) { return }
did -of acomp 2 1 $did(acomp,1,0).text
did -c acomp 2 1 1 $calc($len($did(acomp,2).text) +1)
}
dialog -l acomp {
title "Auto Complete"
size -1 -1 90 42
option dbu notheme
combo 1, 6 6 78 56, size edit drop
edit "", 2, 6 6 69 10
button "&Close", 3, 48 24 37 12, ok
}
on *:dialog:acomp:init:0: { .timer -m 1 0 acomp.init }
on *:dialog:acomp:edit:2: { .timer -m 1 0 acomp.edit }
on *:dialog:acomp:sclick:1: { .timer -m 1 0 acomp.select }