| 
 | 
 
Joined:  Dec 2002 
Posts: 1,245  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 1,245  | 
Qwerty said:  You need to do it at runtime: use the sclick event to watch for tab clicks and the /did -t command to dynamically set the default button. 
 so test with this  
alias list dialog -m list list
dialog list {
  title "List Box"
  size -1 -1 200 100
  option dbu
  tab "One", 1, 0 0 200 100
  tab "Two", 2
  list 100, 20 20 160 60, tab 1
  button "Add", 900, 30 75 60 10, tab 1
  button "Remove", 901, 110 75 60 10, tab 1
  list 101, 20 20 160 60, tab 2
  button "Add", 902, 30 75 60 10, tab 2
  button "Remove", 903, 110 75 60 10, tab 2
}
on *:dialog:list:init:0:{
  did -b list 901,903
}
on *:dialog:list:sclick:1:{
  did -t list 100 1
}
on *:dialog:list:sclick:2:{
  did -t list 101 1
}
on *:dialog:list:sclick:900:{
  if ($cb(0)) { 
    did -a list 100 $cb 
    did -e list 901 
  }
}  
on *:dialog:list:sclick:901:{
  did -d list 100 $did(list,100).sel
  if (!$did(list,100).lines) { did -b list 901 }
}
on *:dialog:list:sclick:902:{
  if ($cb(0)) { 
    did -a list 101 $cb 
    did -e list 903 
  }
}  
on *:dialog:list:sclick:903:{
  did -d list 101 $did(list,101).sel
  if (!$did(list,101).lines) { did -b list 903 }
}
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 1,245  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 1,245  | 
I have tested it here again, and i get no errors what are the errors you get?? did you paste my code or are you adapting yours and still getting errors there? 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
i copy/pasted YOUR code (last) and only changed dialog name coz it fux up when i call /list
  i get errors on this lines:
  for tab 1   did -d listme 100 $did(listme,100).sel
  for tab 2   did -d listme 101 $did(listme,101).sel
  to repeat i get in passive click this errors, not in active 
Last edited by raZOR; 12/05/06 06:20 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 1,245  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 1,245  | 
whether passive or active (and the sclick for the tab ID should stop passive) I get no errors 
alias listme dialog -m listme listme
dialog listme {
  title "listme Box"
  size -1 -1 200 100
  option dbu
  tab "One", 1, 0 0 200 100
  tab "Two", 2
  list 100, 20 20 160 60, tab 1
  button "Add", 900, 30 75 60 10, tab 1
  button "Remove", 901, 110 75 60 10, tab 1
  list 101, 20 20 160 60, tab 2
  button "Add", 902, 30 75 60 10, tab 2
  button "Remove", 903, 110 75 60 10, tab 2
}
on *:dialog:listme:init:0:{
  did -b listme 901,903
}
on *:dialog:listme:sclick:1:{
  did -t listme 100 1
}
on *:dialog:listme:sclick:2:{
  did -t listme 101 1
}
on *:dialog:listme:sclick:900:{
  if ($cb(0)) { 
    did -a listme 100 $cb 
    did -e listme 901 
  }
}  
on *:dialog:listme:sclick:901:{
  did -d listme 100 $did(listme,100).sel
  if (!$did(listme,100).lines) { did -b listme 901 }
}
on *:dialog:listme:sclick:902:{
  if ($cb(0)) { 
    did -a listme 101 $cb 
    did -e listme 903 
  }
}  
on *:dialog:listme:sclick:903:{
  did -d listme 101 $did(listme,101).sel
  if (!$did(listme,101).lines) { did -b listme 903 }
}
renamed it all  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
now tried on clean mirc 6.17 i get same errors for same lines.
  ehm... weird case ? 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 1,245  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 1,245  | 
Since I don't get the error, maybe someone else can tell you what is causing the error and how to get rid of it. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 1,245  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 1,245  | 
you could try changing these lines on *:dialog:listme:sclick:1:{   did -t listme 100 1 } on *:dialog:listme:sclick:2:{   did -t listme 101 1 }
  to on *:dialog:listme:sclick:1:{   did -t listme 900 } on *:dialog:listme:sclick:2:{   did -t listme 902 } 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Sep 2005 
Posts: 2,630  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Sep 2005 
Posts: 2,630  | 
If you're using the same definition of 'passive' as the screenshot earlier, I told you, nothing is actually selected there, so .sel will always be 0. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
well if .sel is always 0 then why doesnt this code prevent it ?   if ($did(listme,100).sel == 0) { did -b listme 901 } or it is impossible to have this kind of "detection" :P ? sorry for being dumb    
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Sep 2005 
Posts: 2,630  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Sep 2005 
Posts: 2,630  | 
Where abouts is that if statement? 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
on *:dialog:listme:sclick:901:{   did -d listme 100 $did(listme,100).sel   if ($did(listme,100).sel == 0) { did -b listme 901 }     if (!$did(listme,100).lines) { did -b listme 901 } }
  i put it before line detection 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Sep 2005 
Posts: 2,630  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Sep 2005 
Posts: 2,630  | 
Try this: on *:dialog:listme:sclick:901:{
  if (!$did(100).sel) || (!$did(100).lines) { 
    did -b listme 901 
    return
  }
  did -d listme 100 $did(100).sel
  did -b listme 901
}It's not very logical to try and delete the selected item and THEN check if there's one selected :tongue:  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
now it dont give errors but it disables in passive remove and when clicked on item (that IS there) it isnt enabled anymore :P
  "It's not very logical to try and delete the selected item and THEN check if there's one selected"
  sure is, if you want to see if there is anything left or not. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Sep 2005 
Posts: 2,630  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Sep 2005 
Posts: 2,630  | 
now it dont give errors but it disables in passive remove and when clicked on item (that IS there) it isnt enabled anymore :P on *:dialog:listme:sclick:100: did -e listme 901 sure is, if you want to see if there is anything left or not.  Yeah, I was talking about error prevention though.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2005 
Posts: 1,008  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Apr 2005 
Posts: 1,008  | 
thank you so much, to all of you ! this work perfect now !!!
  /me buys cookies to all 
 
 |  
 
 | 
 
 
 |  
 
 
   |  
 
 |