dialog list {
title "List Box"
size -1 -1 200 100
option dbu
list 100, 20 20 160 60
button "Add", 900, 30 75 60 10
button "Remove", 901, 110 75 60 10
}
;; disable the remove button when starting
on *:dialog:list:init:0:{
did -b list 901
}
;; Add something to the listbox,
;; and if something is added, enable the remove button
on *:dialog:list:sclick:900:{
if ($cb(0)) {
did -a list 100 $cb
did -e list 901
}
}
;; Remove a line from the list
;; if the list is empty, disable the remove button
on *:dialog:list:sclick:901:{
did -d list 100 $did(list,100).sel
if (!$did(list,100).lines) { did -b list 901 }
}