mIRC Homepage
Posted By: rompa Reading content from multi line edit box - 08/07/10 11:18 PM
hi

is it possible to read the whole content of an multi line edit box?
example code:
Quote:
menu channel {
-
testdialog: { .timerkhcd 1 0 cdialog }
}
alias cdialog { dialog -md testdia testdia }

dialog testdia {
size -1 -1 200 200
edit "" 1, 10 10 80 60, multi return autovs
button "ok" 2, 80 80 30 20
edit "" 3, 100 10 80 60, multi return autovs
}

on *:dialog:testdia:sclick:2: {
did -ra testdia 3 $did(testdia,1).text
set %testdiavar $did(testdia,1).text
}

when you enter multiple lines in the left edit box and afterwards hit "ok"...
the above code will only read the first line of the editbox ,copies the line to second box and loads the line into the variable.

But how do i get the 2nd,3rd... n.th line?


a "list" is not a good alternative in this case because the user has to enter text into this box, it's not a generated list

thanks in advance for any helping answer smile
Posted By: RusselB Re: Reading content from multi line edit box - 08/07/10 11:38 PM
You're currently using the format of $did(<dialog>,<ID>).text

For you situation, I'd recommend using the format of $did(<dialog>,<ID>,<line>)

the .text is optional
Posted By: Wims Re: Reading content from multi line edit box - 08/07/10 11:48 PM
Use $didtok, /help $didtok smile
Posted By: rompa Re: Reading content from multi line edit box - 09/07/10 02:08 AM
thanks to both of you! exactly what i was looking for.

if any other beginner comes across this issue, here is the extended little example code:
Quote:
menu channel {
-
testdialog: { .timerkhcd 1 0 cdialog }
}
alias cdialog { dialog -md testdia testdia }

dialog testdia {
size -1 -1 200 200
edit "" 1, 10 10 80 60, multi return autovs
button "read" 2, 80 80 30 20
edit "" 3, 100 10 80 60, multi return autovs
}

on *:dialog:testdia:sclick:2: {
var %create
var %i = 1
while (($did(testdia,1,%i) != $null) && (%i < 5)) {
if (%i == 1) { %create = $did(testdia,1,%i) }
else { %create = %create $+ $chr(59) $+ $did(testdia,1,%i) }
inc %i
}
didtok testdia 3 59 %create
set %testdiavar %create
}
Posted By: chacha Re: Reading content from multi line edit box - 12/07/10 02:47 PM
Code:
on *:dialog:testdia:sclick:2:{
  var %x $didtok($dname,1,59)
  didtok $dname 3 59 %x
  set %testdiavar %x
}
© mIRC Discussion Forums