This is the entire script. I have isolated this part in a dedicated test.ini file, so other script should not interfere

Code:
[script]
 menu status,channel,query {
  ..-
  - T E S T I N G -
  .- Command - : /xtest
 }
;########################### 
 alias xtest { dialog -m dialog1 dialog1 }
 dialog dialog1 {
  title "Test dialog"
  size -1 -1 401 161
  option pixels
  text "List", 2, 7 3 49 12
  edit "", 1, 2 17 221 109, multi return autohs autovs hsbar sbar
  button "OK", 100, 91 133 44 20, ok
  check "TAB", 30, 355 18 50 20
  text "Separator", 4, 235 21 57 16
  edit "", 40, 300 18 48 21
  text "First element", 5, 235 55 75 16
  edit "", 50, 340 49 48 21
  text "Second element", 6, 235 89 103 16
  edit "", 60, 340 83 48 21
}
 on 1:dialog:dialog1:sclick:30:{
 if ($did(dialog1,30).state == 1) { /did -m dialog1 40 } 
 else { /did -n dialog1 40 } 
}
 on 1:dialog:dialog1:edit:*:{ 
 if ($did(dialog1,30).state == 0){ /set %var1 asc($did(40).text) }
 else { /set %var1 $chr(45) }
} 
 on 1:dialog:dialog1:sclick:100:{ 
 var %i = 1
 while (%i <= $did(1).lines) {
 %line = $did(1,%i).text
 %first = $gettok(%line,$did(50).text,%var1)
 %second = $gettok(%line,$did(60).text,%var1)
 inc %i
 /echo -a state $did(dialog1,30).state
 /echo -a data %var1 
 /echo -a text $asc($did(40).text)
 /echo -a first %first
 /echo -a second %second
 }
}