mIRC Home    About    Download    Register    News    Help

Print Thread
Dialogs, $did, and text on multi-line editboxes #86900 14/06/04 09:54 PM
Joined: Dec 2002
Posts: 46
Z
zac Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Dec 2002
Posts: 46
This is partially a feature request and partially a complaint/bug report. I'm filing it under bug report, but if it's misfiled feel free to move it.

In mIRC dialogs, edit boxes can be multi-lined, allowing you to access them with $did(<name>, <id>, <line>). However, this is highly limiting at times.

When the multi-line text contain a word or words which must be wrapped, mIRC adds a space in to compensate. However, this makes the data impossible to be put back together properly.

$did(<name>, <did>, 1) $+ $did(<name>, <did>, 2) could yield either "wordword" or "word word" depending on how mIRC wraps it. Without the $+, you may end up with "word word" when it was originally "wordword". Both not good situations.

Windows can copy and paste the editbox fine without the random-space issue. This is one of the only good parts, as I can still deal with the data on some levels.

What I'm requesting is a method to get the raw text from the editbox's multiple lines, without mIRC's space-wrapping. It seems possible, and it'd be wholly helpful.

If it's possible as it is now, please do share and highlight my ignorance.

Re: Dialogs, $did, and text on multi-line editboxes #86901 14/06/04 11:25 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
I'm trying to get mIRC to do what you're saying but it's not adding any extra spaces. Could you give an example (simple dialog table + input text) which reproduces the problem?

Even if this isn't a bug, it might be nice if there was a $did(dialog, id, &binvar) form of the identifier.

Edit: I'm using Win98SE with mIRC 6.15. What OS/mIRC version are you getting this bug on?

Last edited by starbucks_mafia; 14/06/04 11:28 PM.

Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: Dialogs, $did, and text on multi-line editboxes #86902 14/06/04 11:34 PM
Joined: Dec 2002
Posts: 46
Z
zac Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Dec 2002
Posts: 46
Code:
dialog -l example {
  title "Example"
  size -1 -1 102 68
  option dbu
  edit "", 1, 1 1 100 50, multi autovs vsbar
  button "Echo", 2, 34 53 37 12
}

on *:dialog:example:sclick:2:{
  var %i = 1
  while ($did($dname, 1, %i)) { 
    echo -a $ifmatch
    var %full = %full $ifmatch
    inc %i
  }
  echo -a Reconstructed: %full
}

alias example dialog -m example example


Type /example and type text.

Make one long string (longer than the editbox allows per one line), and hit echo. It'll show it broken up. Sure, you say, use $+.. but...

Type a long string, and maybe 5-6 chars before the end of that line, hit space, and start typing again. Do a very long string after. You have a legitimate break here, and a $+ would join the two spaced strings.

Now copy either of the examples above fom the editbox and paste into notepad. You'll see it's reconstructed correctly.

Re: Dialogs, $did, and text on multi-line editboxes #86903 14/06/04 11:55 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
The problem isn't in $did(), it's in the way you're storing what it's returning. mIRC variables will have spaces trimmed from the end of them so when you add a line to the %full variable which has a space on the end it's being stripped and it's as if the space never existed. The solution comes from the fact that spaces are not stripped fromt the beginning of a variable, so you must construct it in reverse. Use this code instead and you'll get the correct text:
Code:
on *:dialog:example:sclick:2:{
  var %i = $did($dname, 1).lines
  while %i { 
    echo -a $did($dname, 1, %i)
    var %full = $did($dname, 1, %i) $+ %full
    dec %i
  }
  echo -a Reconstructed: %full
}


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: Dialogs, $did, and text on multi-line editboxes #86904 15/06/04 12:00 AM
Joined: Dec 2002
Posts: 46
Z
zac Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Dec 2002
Posts: 46
Ah, tricky little bugger. Thanks a ton.

Re: Dialogs, $did, and text on multi-line editboxe #86905 15/06/04 06:06 AM
Joined: Apr 2003
Posts: 36
L
LifeIsPain Offline
Ameglian cow
Offline
Ameglian cow
L
Joined: Apr 2003
Posts: 36
On top of the option Starbucks gave, I use the following:
Code:
$replace($didtok($dname,$did,10),$chr(10),$null)

well, you would need to replace the $did with your actual did if applicable, as well as $dname, found it from somewhere on the forums, but forget who said it.

Re: Dialogs, $did, and text on multi-line editboxe #86906 24/06/04 02:20 AM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
I guess this is a redundant version for $remove($didtok($dname,$did,10),$chr(10)) (unless $remove() is slower or the like)...


* cold edits his posts 24/7
Re: Dialogs, $did, and text on multi-line editboxe #86907 24/06/04 04:43 PM
Joined: Apr 2003
Posts: 36
L
LifeIsPain Offline
Ameglian cow
Offline
Ameglian cow
L
Joined: Apr 2003
Posts: 36
You know, I really am not sure, $remove would make more sence, but I saw it used as $replace on here somewhere I am mostly sure by some big poster and decided to stay with it. So I don't know if it was benchmarked, or if I remember wrong. But hey, this way uses less characters.