mIRC Home    About    Download    Register    News    Help

Print Thread
Get text line from mous in custum window #148222 01/05/06 12:38 PM
Joined: Jun 2004
Posts: 20
C
Cork Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jun 2004
Posts: 20
I use a custum window to create a log window and would like to be able to right click a line to remove it, the lines is stored as text and not list-box lines.

I'v looked everywhere i can find but can't find the least bit of info on this.

thanks for all replies
Cork

Re: Get text line from mous in custum window #148223 01/05/06 02:08 PM
Joined: Apr 2006
Posts: 14
O
oneline Offline
Pikka bird
Offline
Pikka bird
O
Joined: Apr 2006
Posts: 14
Instead of echo'ing all the lines to the window you could make a /window -l186 or whatever size so the listbox takes up full window and then add lines with /aline -l, but since you already said yours isnt using listbox i think you might have thought of this already.

Re: Get text line from mous in custum window #148224 01/05/06 02:16 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I don't think you can remove lines like that, unless the window is a listbox-type. You may want to try putting reference numbers next to every line, then you could make a command that searches for a line beginning with whatever line reference number you enter, and deletes it. I think /filter would probably work well for this.

Code:
/filter -wwcpzx @window @window 832 *

(untested)

-genius_at_work

Re: Get text line from mous in custum window #148225 01/05/06 04:04 PM
Joined: Jun 2004
Posts: 20
C
Cork Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jun 2004
Posts: 20
Yes, I'v thought about listbox but cause it dosn't do linebrake its not interesting.
And the removage of the line isn't a problem I just need to convert the mouse position to line number or the text line then its doable with /dline or /dline $fline .

Cork

Re: Get text line from mous in custum window #148226 02/05/06 04:47 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The codes not hard to script, was hard to think of before i needed it myself, i did something similar where i wanted a list box on the left and right, but i didnt want a real lsitbox on the left, since i also wanted to be able to copy and paste from it. In mine i invert using ctrl-r the line the mouse is on in the hotlink, removing it from the previous line. So its like one constantly highlighting line. But for your need i simply enabled u to get the line number the mouse is on during a right click.

Code:
on ^1:HOTLINK:*:@windowname:{ set %windowname.lastpos $mouse.x $mouse.y $hotlinepos }
menu @windowname {
  rclick:{ if ($mouse.x $mouse.y == $gettok(%windowname.lastpos,1-2,32)) { dline @windowname $gettok(%windowname.lastpos,4,32)) } }
}


* only bad thing is this doesnt deal with you right clicking over spaces in the line, but well to bad! lol

* replace all occrances of "windowname" including in the sets with YOUR windows name.

* if you dont want the fingerpointer add a | HALT to the end of the hotlink, but this makes for not so easy to spot that u need to be over text, and the mouse never changes.

%windowname.lastpos contains 4 space seperated values that were pulled at the last hotlink event (mouse over text event) mousex mousey word# line#

(word# is which word the mouse is over, u likely dont need it, but i left it in incase you have a brain flash for something else)

Re: Get text line from mous in custum window #148227 02/05/06 03:14 PM
Joined: Jun 2004
Posts: 20
C
Cork Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jun 2004
Posts: 20
ow nice! i get the ide grin

Cant get it to work though the on ^1:HOTLINK event blocks the menu command to trigger except over spaces for me what ever i try and the hotlink only works over text so i have to move the mouse to the the diffrent events to trigger and there of braking the x y link did i do anythin wrong?

Code:
on ^1:HOTLINK:*:@Topics:{ set %Topics.lastpos $mouse.x $mouse.y $hotlinepos }
menu @Topics {
  rclick:{ if ($mouse.x $mouse.y == $gettok(%Topics.lastpos,1-2,32)) { dline @Topics $gettok(%Topics.lastpos,4,32)) } }
}
 

Cork

Re: Get text line from mous in custum window #148228 02/05/06 07:52 PM
Joined: Dec 2004
Posts: 66
B
Bob57 Offline
Babel fish
Offline
Babel fish
B
Joined: Dec 2004
Posts: 66
Try:
Code:
on ^1:HOTLINK:*:@Topics:{
  set %Topics.lastpos $mouse.x $mouse.y $hotlinepos
  halt
}
You'll lose the mouse hand but it seemed to work in my test script.

Re: Get text line from mous in custum window #148229 02/05/06 08:25 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
as Bob57 said add the HALT but really if u wanted a menu there you should have said, what u said was "would like to be able to right click a line to remove it" and from that i assumed u just wanted to right click to remove the line, aka no menu needed.

Re: Get text line from mous in custum window #148230 03/05/06 04:17 AM
Joined: Jun 2004
Posts: 20
C
Cork Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jun 2004
Posts: 20
yup yup that fixes the script thanks both of you!

and no i didnt want a menu i just couldent get the script to work at all.

Cork

Re: Get text line from mous in custum window #148231 03/05/06 06:58 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
hmmmm ok thats a bit wierd, it worked fine for me, maybe you have another script somwhere that was picking up the non halted preevent hotlink or something, anyway it works now.