mIRC Home    About    Download    Register    News    Help

Print Thread
#102511 09/11/04 09:01 PM
Joined: Nov 2004
Posts: 2
R
Redee Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
R
Joined: Nov 2004
Posts: 2
Hi wink

i've created a dialog with a combobox and 2 buttons

Code:
 
[...]
combo 666,58 30 50 50,tab 1
button "Add",667, 114 30 20 9, tab 1
button "Rem",668, 114 40 20 9, tab 1
[...]
 


if i write something into the upper part of the combo box and klick the add button, the text is added to the lower part

Code:
  

on *:dialog:bla:sclick:*:{
   if ($did == 667) && ($did($dname,666).sel == $null) && ($did($dname,666).text != $null) { 
did -a $dname 666 $did($dname,666).text 
  }
}



now i want, that if i close the dialog and restart it, the values that were in the combo box before, are reloaded too

pleeeeeeeeeaaaaaaaase help me smile

#102512 09/11/04 10:05 PM
Joined: Feb 2003
Posts: 38
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Feb 2003
Posts: 38
Save these to a tokenized variable (/help variables) on dialog close (on *:dialog:bla:close:*:) and load them on initiate (on *:dialog:bla:init:*:).

#102513 10/11/04 01:49 AM
Joined: Nov 2004
Posts: 2
R
Redee Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
R
Joined: Nov 2004
Posts: 2
i really don't know what a tokenized variable is, but this is how i tried to solve my problem:

i created an ok and an apply button and either of them starts an alias:

Code:
 
 [...]

var %chanvar = 1
    while ( %chanvar <= $did($dname,666).lines ) { 
      set %chanoff. [ $+ [ %chanvar ] ] $did($dname,666,%chanvar).text       
      set %chansaveini %chanvar
      inc %chanvar
      continue
    }

[...]
 


an if i start the dialog an other alias:

Code:
 
var %chanload = 1
  while ( %chanload <= %chansaveini ) {
    did -a mlock 666 %chanoff. [ $+ [ %chanvar ] ]
    inc %chanload
    continue
  }
  unset %chansaveini

 


hm
now i've got the problem, that the values i from the variables are loaded on dialog init, but the values are invisible
if i klick onto the lower part of the como box, i can see that there is definitely something, but i can't see what it is wink

#102514 10/11/04 07:04 AM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Something silly like this will suffice.

on *:dialog:bla:sclick:*:{
if (($did == 667) && (!$did($dname,666).sel)) {
didtok $dname 666 255 $did($dname,666).text
}
if (($did == 668) && ($did($dname,666).sel)) {
did -d $dname 666 $did($dname,666).sel
}
}

On *:dialog:bla:init:*:{
tokenize 255 %_store
var %i = $0
while (%i) {
didtok $dname 666 255 $($+($,%i),2)
dec %i
}
}
On *:dialog:bla:close:*:{
tokenize 255 $didtok($dname,666,255)
if ($0 >= 1) {
unset %_store
var %i = $0
while (%i) { set %_store $addtok(%_store,$($+($,%i),2),255) | dec %i }
}
}

Eamonn.


Link Copied to Clipboard