mIRC Home    About    Download    Register    News    Help

Print Thread
Reading content from multi line edit box #222915 08/07/10 11:18 PM
Joined: Jul 2010
Posts: 2
R
rompa Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
R
Joined: Jul 2010
Posts: 2
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

Last edited by rompa; 09/07/10 01:57 AM.
Re: Reading content from multi line edit box [Re: rompa] #222916 08/07/10 11:38 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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

Re: Reading content from multi line edit box [Re: rompa] #222917 08/07/10 11:48 PM
Joined: Jul 2006
Posts: 3,715
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,715
Use $didtok, /help $didtok smile


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Reading content from multi line edit box [Re: Wims] #222918 09/07/10 02:08 AM
Joined: Jul 2010
Posts: 2
R
rompa Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
R
Joined: Jul 2010
Posts: 2
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
}

Re: Reading content from multi line edit box [Re: rompa] #223030 12/07/10 02:47 PM
Joined: Feb 2009
Posts: 133
C
chacha Offline
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
Code:
on *:dialog:testdia:sclick:2:{
  var %x $didtok($dname,1,59)
  didtok $dname 3 59 %x
  set %testdiavar %x
}


WorldDMT