mIRC Homepage
Posted By: SkyD editbox - 27/07/05 06:41 PM
One line of my dialog:
Code:
 edit "", 11, 18 42 409 288, multi return vsbar



on *:DIALOG:test:sclick:16: {
write txt/file.txt $1
}


How can i save the text which is in editbox in my file.txt ..??
Posted By: SkyD Re: editbox - 27/07/05 06:42 PM
I find.. sorry for POST!
Posted By: SkyD Re: editbox - 28/07/05 07:07 AM
I have other problem! If i click on ITEM it dont open a dialog... I use this:
on *:DIALOG:pieraksts:sclick:11: {
/dialog -m about_ about_
}
Posted By: Boris1234 Re: editbox - 28/07/05 08:47 AM
Can you tell me how did yo save a file which is in editbox in to your file.txt ?

i have a problem with that
Posted By: ClickHeRe Re: editbox - 28/07/05 11:06 AM
use /savebuf and /loadbuf to save/load whole contents of edits in dialogs
Posted By: Riamus2 Re: editbox - 28/07/05 12:48 PM
If you want to save text from an editbox in a custom dialog, you use:

/write file.txt $did($dname,ID).text

Note tha you if you're in a dialog event, you can reduce this down to:

/write file.txt $did(ID)

ID is the ID of your editbox.
Posted By: Boris1234 Re: editbox - 28/07/05 01:02 PM
Thank's (:
Posted By: SkyD Re: editbox - 28/07/05 05:27 PM
I've editbox with multi and vsbar functions! How can i save all lines in file.txt and read all lines in that editbox.. I make Notepad!
Posted By: Riamus2 Re: editbox - 28/07/05 05:45 PM

Use a loop like this:

Code:
set %cnt 1
while (%cnt <= $did(NAME,ID).lines) {
  write file.txt $did(NAME,ID,%cnt)
}
unset %cnt


Info:

$did(NAME,ID).lines = # of lines in your multiline edit box
$did(NAME,ID,N) = Text from line N

NAME = Your dialog name. If called within a dialog event, you can use $dname, or even just leave that off altogether.

ID = ID of the edit box
Posted By: SkyD Re: editbox - 28/07/05 06:12 PM
it doesnt works.. if i write 2lines it save that text which is in editbox 2times ...
editbox: 1line - hey!! bfffffff..... 2line - How are you?

In file.txt -
Hey!! bff
How are you?
Hey!! bff
How are you?


And how i can read all lines in editbox
Posted By: Riamus2 Re: editbox - 28/07/05 07:15 PM
Can you paste the code around where you inserted this so I can see how you're calling it? It sounds like you have another loop going on.
Posted By: SkyD Re: editbox - 28/07/05 07:31 PM
Code:
on *:DIALOG:pieraksts:sclick:16: {
set %cnt 1
while (%cnt <= $did(pieraksts,11).lines) {
  write file.txt $did(pieraksts,11,%cnt)
}
unset %cnt
}

  
Posted By: Riamus2 Re: editbox - 28/07/05 07:37 PM
I'm sorry... it's my fault... I always forget to include INC. frown

Here:

Code:
set %cnt 1
while (%cnt <= $did(NAME,ID).lines) {
  write file.txt $did(NAME,ID,%cnt)
  inc %cnt
}
unset %cnt


closed code tags
Posted By: SkyD Re: editbox - 29/07/05 11:16 AM
Ok, that's work.. But on open a dialog how can i read all text in editbox???
Posted By: Riamus2 Re: editbox - 29/07/05 12:56 PM
On open, the only text in an edit box is text you put there. You don't need to read it since you already know what it is. The only way there's text there is if you put it in the dialog's edit "____" part when creating it, or if you use /did -a to stick it in there on init.
Posted By: SkyD Re: editbox - 29/07/05 04:07 PM
You don't understand.. I open the dialog write in text in the big editbox then press OK button and it save the text in file.txt .. I close the dialog..!! I need that when i open the dialog again the text will be in the editbox!
Posted By: Riamus2 Re: editbox - 29/07/05 06:02 PM
Ok, I see what you mean.

Code:
on *:dialog:NAME:init:*: {
  did -a $dname ID $read(file.txt)
}


Replace NAME and ID and change the filename.

Note that if you are adding many lines to a multiline edit box, you'll need to put in a loop to read in every line in the file.txt...

Code:
on *:dialog:NAME:init:*: {
  set %cnt $lines(file.txt)
  while (%cnt >= 1) {
    did -i $dname ID 1 $read(file.txt,%cnt)
    dec %cnt
  }
  unset %cnt
}
Posted By: SkyD Re: editbox - 29/07/05 06:44 PM
I have one more question ..!! How can i read lenght in all lines not only in $did(ID,1 or 2 ...)
Posted By: Riamus2 Re: editbox - 29/07/05 07:19 PM
You'll have to do a loop $did(NAME,ID).lines is total lines, so loop from 1 to that using a WHILE loop and add up all the lengths.
Posted By: SkyD Re: editbox - 29/07/05 07:32 PM
ehh... i cant find a right way to make it work.
I have this:
Code:
 
  set %l $did(11).lines
  while (%l <= $did(11)) {
    did -a pieraksts 19 $did(11,%l).len
    inc %l
  }
  unset %l

 
Posted By: Riamus2 Re: editbox - 30/07/05 09:25 PM
Code:
set %l 1
while (%l <= $did(11).lines) {
  did -a pieraksts 19 $did(11,%l).len
  inc %l
}
unset %l
© mIRC Discussion Forums