mIRC Home    About    Download    Register    News    Help

Print Thread
listboxes #3436 25/12/02 08:56 AM
Joined: Dec 2002
Posts: 15
_
_Marky_ Offline OP
Pikka bird
OP Offline
Pikka bird
_
Joined: Dec 2002
Posts: 15
heres parts of a dialog i made:

Code:
  button "Add", 6, 220 30 23 12
  button "Remove", 7, 220 45 23 12
  edit "", 21, 122 20 95 10
  list 22, 122 32 95 34, size vsbar
}

on *:dialog:blaway:sclick:6: { did -a $dname 22 $did(21) | did -r $dname 21 }

on *:dialog:blaway:sclick:7: { did -d $dname 22 $did($dname,22).sel }


this is part of an away script
it adds reasons to the list box
How would i go about somehow saving the list, so that next time i open the dialog, its still there in the list box ?
Would i have to add and remove them from a txt file as i click the add and remove buttons, or is there a way to directly load up the list.


Re: listboxes #3437 25/12/02 09:28 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Code:
on *:dialog:blaway:init:0:{
  var %line = 1
  while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
    did -a $dname 22 $eval(% $+ blawayl $+ %line,2)
    inc %line
  }
}
on *:dialog:blaway:close:0:{
  var %line = 1
  while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
    unset $eval(% $+ blawayl $+ %line)
    inc %line
  }
  var %line = 1
  while ( $did(blaway,22,%line).text != $null ) {
    set %blawayl $+ %line $did($dname,22,%line).text
    inc %line
  }
}

Re: listboxes #3438 25/12/02 10:30 AM
Joined: Dec 2002
Posts: 15
_
_Marky_ Offline OP
Pikka bird
OP Offline
Pikka bird
_
Joined: Dec 2002
Posts: 15
frown that didnt work
i made sure i had no other on *:dialog:blaway:init: or on *:dialog:blaway:close: commands
and it still didnt work
would there be any other way to go about it ?

Re: listboxes #3439 25/12/02 10:59 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
I tested it on a fresh install of mIRC, worked fine. Some reasons why it wouldn't work is an outdated mIRC or not using "/dialog -m blaway blaway" to make the dialog.

The other ways of doing it would be putting while or goto loops in aliases and using the alias every time you opened/closed the dialog, but that is just a different way of writing the same thing.

No idea why it doesn't work for you, hopefully someone else can help confused

Here is the entire script I used:

Code:
dialog blaway {
  title "blaway"
  size -1 -1 223 145
  option dbu
  list 22, 5 25 100 100
}
on *:dialog:blaway:init:0:{
  var %line = 1
  while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
    did -a $dname 22 $eval(% $+ blawayl $+ %line,2)
    inc %line
  }
}
on *:dialog:blaway:close:0:{
  var %line = 1
  while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
    unset % $+ blawayl $+ %line
    inc %line
  }
  var %line = 1
  while ( $did(blaway,22,%line).text != $null ) {
    set %blawayl $+ %line $did($dname,22,%line).text
    inc %line
  }
}

Re: listboxes #3440 25/12/02 01:49 PM
Joined: Dec 2002
Posts: 15
_
_Marky_ Offline OP
Pikka bird
OP Offline
Pikka bird
_
Joined: Dec 2002
Posts: 15
ok i wen through my hole script
i had an extra "}" b4 the script start
so it was stuffing it up
but now
if i remove a reason form the list box
the next time i open it
its still there confused

Re: listboxes #3441 25/12/02 01:51 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Dunno why that is, it shouldn't happen because all variables are unset and then set again when you close it. Works for me, very odd, and annoying,..

Re: listboxes #3442 25/12/02 02:03 PM
Joined: Dec 2002
Posts: 15
_
_Marky_ Offline OP
Pikka bird
OP Offline
Pikka bird
_
Joined: Dec 2002
Posts: 15
im using 6.03 so i dunno...
ill fiddle around with it

thanks a bunch mate

Re: listboxes #3443 25/12/02 09:11 PM
Joined: Dec 2002
Posts: 699
N
Nimue Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Code:
on *:dialog:blaway:init:*:{
  if ($exists(blawaybuf.txt)) loadbuf -o $dname 22 blawaybuf.txt
}
on *:dialog:blaway:close:*:{
  savebuf -o $dname 22 blawaybuf.txt
}

Re: listboxes #3444 26/12/02 03:59 AM
Joined: Dec 2002
Posts: 15
_
_Marky_ Offline OP
Pikka bird
OP Offline
Pikka bird
_
Joined: Dec 2002
Posts: 15
that works perfectly grin
thanks

Re: listboxes #3445 26/12/02 03:17 PM
Joined: Dec 2002
Posts: 580
N
NaquadaServ Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
Besides using loadbuf, also check out /didtok and $didtok


NaquadaBomb
www.mirc-dll.com