mIRC Home    About    Download    Register    News    Help

Print Thread
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.
Joined: Aug 2004
Posts: 7,252
R
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

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Use $didtok, /help $didtok smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
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
}

Joined: Feb 2009
Posts: 133
C
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

Link Copied to Clipboard