mIRC Home    About    Download    Register    News    Help

Print Thread
#191929 18/12/07 08:37 AM
Joined: Dec 2006
Posts: 39
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2006
Posts: 39
Code:
 
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,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
.sel refers to a line number, not the text selected. For that, use .seltext


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Quote:
I tried to remove selected word on listbox 1


Code:
elseif ($did == 5) { did -d $dname 1 $did($dname,2).sel }


Should be:

Code:
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.
Crinul #191941 18/12/07 06:39 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
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?



Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Lpfix5 #191948 18/12/07 09:09 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Originally Posted By: skovicniq
Code:
 
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


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Lpfix5 #191964 19/12/07 01:38 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #191975 19/12/07 01:16 PM
Joined: Dec 2006
Posts: 39
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2006
Posts: 39
I just want to remove selected text in list box (1) by pressing remove button. Sorry for poor explaination.

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
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: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Code:
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 - Edit
One last effort :P

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Originally Posted By: skovicniq
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 both

voila so anytime you select anything from weather whatever box it will delete contents


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }

Link Copied to Clipboard