| 
 | 
 
| 
 
skovicniq
 
 | 
 
| 
 skovicniq 
 | 
  
list 1, 5 5 70 60
  edit "", 2, 5 62 70 10, autohs
  button "rem", 5, 26 85 20 10
elseif ($did == 5) { did -d $dname 1 $did($dname,2).sel }
I tried to remove selected word on listbox 1. But didnt working. I got this  /did: invalid parameters (line 35, script3.ini) Thanks  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Oct 2004 
Posts: 8,061  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Oct 2004 
Posts: 8,061  | 
.sel refers to a line number, not the text selected.  For that, use .seltext 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Feb 2006 
Posts: 180  
Vogon poet 
 | 
 
 
Vogon poet 
Joined:  Feb 2006 
Posts: 180  | 
I tried to remove selected word on listbox 1 elseif ($did == 5) { did -d $dname 1 $did($dname,2).sel } Should be:elseif ($did == 5) { did -d $dname 1 $did($dname,1).sel }Edit: This topic, to me, was very unclear... My bad, Riamus2 got the problem that you're having with the code.  
Last edited by Crinul; 18/12/07 11:28 AM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Aug 2005 
Posts: 1,052  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Aug 2005 
Posts: 1,052  | 
Indeed, the only way to remove the selected word would be manually.. if you take the effort to highlight a word in one of your editboxs whats to press the backspace key or delete key on it?
 
  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Oct 2004 
Posts: 8,061  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Oct 2004 
Posts: 8,061  | 
whats to press the backspace key or delete key on it? That's not really difficult... just remove the pieces by editing the line in the edit box using the script.  Depending on how you want to do it and what's the best method, you can use $remove, $remtok, $deltok, or getting more specific $pos and $left, $right, $mid... probably others as well. However, I don't think the original request was about removing text in the edit box, but in the listbox, which is an entirely different matter ... and much easier to accomplish.  The original request for help was a little ambiguous though and could be asking for a few different things, so more specifics would allow us to give a complete response... for example, is he trying to remove from the listbox whatever is highlighted in the editbox, or vice versa, or remove what was selected in the listbox from the listbox, or what?  It's not really that clear.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Aug 2005 
Posts: 1,052  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Aug 2005 
Posts: 1,052  | 
  
list 1, 5 5 70 60
  edit "", 2, 5 62 70 10, autohs
  button "rem", 5, 26 85 20 10
elseif ($did == 5) { did -d $dname 1 $did($dname,2).sel }
I tried to remove selected word on listbox 1. But didnt working. I got this  /did: invalid parameters (line 35, script3.ini) Thanks   Um when removing a line from a listbox you might want to use the SAME ID witrhin the did command example listbox  elseif ($did == 5) { did -d $dname 1 $did($dname,1).sel }  would remove the word in listbox one if listbox 1 had a word selectled notice how you use $did($dname, 2).sel in a editbox you can clear the line by using did -r $dname ID this will clompletely erase a line in a editbox  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Oct 2004 
Posts: 8,061  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Oct 2004 
Posts: 8,061  | 
Yeah, that was mentioned before as well.  However, I'm not sure that that's what is being requested.  It sounds like the line being removed from the listbox is one matching text that is selected in the editbox.  Of course, like I said, the explanation of what's wanted is so obscure as to mean multiple things and trying to guess is a waste of time and effort... especially when the OP hasn't come back to explain. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
skovicniq
 
 | 
 
| 
 skovicniq 
 | 
I just want to remove selected text in list box (1) by pressing remove button. Sorry for poor explaination. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 503  
Fjord artisan 
 | 
 
 
Fjord artisan 
Joined:  Dec 2002 
Posts: 503  | 
So, the entire content of the 'edit' (2) will have a string in it, and you want to find the matching string in the 'list' (1), and remove that line?
  What do you want to happen if the string in the edit doesn't exist in the list? 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Feb 2006 
Posts: 180  
Vogon poet 
 | 
 
 
Vogon poet 
Joined:  Feb 2006 
Posts: 180  | 
dialog test {
  title "mIRC"
  size -1 -1 110 100
  option dbu
  list 1, 15 34 80 48
  edit "", 2, 15 22 80 10, autohs
  button  "Rem", 5, 40 82 30 10
}
on *:dialog:test:init:*: {
  ;Add some words
  did -a $dname 1 Some
  did -a $dname 1 Other
  did -a $dname 1 Help
  did -a $dname 1 Word
}
on *:dialog:test:sclick:*: {
  ;case 1 - Button: remove a selected word in the listbox - select word AND press Rem
  if ($did == 5) {
    did -d $dname 1 $did($dname,1).sel
  }
}
on *:dialog:test:edit:*: {
  ;case 2 - Edit : type some word in the edit, some word that exists in the ListBox
  if ($did == 2) {
    if $_found($dname,1,$did($did)) {
      did -c $dname 1 $ifmatch
      did -d $dname 1 $did($dname,1).sel
      did -r $dname 2
    }
  }
}
alias _found {
  var %f = $did($1,$2).lines
  while (%f >= 1) {
    if ($gettok($did($1,$2,%f),1,32) == $3) return %f
    dec %f 
  }
  else return 0
} Case 1 - Button , Case 2 - EditOne last effort :P  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Aug 2005 
Posts: 1,052  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Aug 2005 
Posts: 1,052  | 
I just want to remove selected text in list box (1) by pressing remove button. Sorry for poor explaination.  elseif ($did == 5) {  if ( $did($dname,1).seltext) { did -d $dname 1 $did($dname,1).sel  } if ( $did($dname,2).seltext) { did -d $dname 2 $did($dname,2).sel } } Checks to see weather if listbox 1 has selected text or 2 or bothvoila so anytime you select anything from weather whatever box it will delete contents  
 
 |  
 
 | 
 
 
 |  
 
   |  
 
 |