mIRC Homepage
Posted By: Cork Get text line from mous in custum window - 01/05/06 12:38 PM
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
Posted By: oneline Re: Get text line from mous in custum window - 01/05/06 02:08 PM
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.
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
Posted By: Cork Re: Get text line from mous in custum window - 01/05/06 04:04 PM
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
Posted By: DaveC Re: Get text line from mous in custum window - 02/05/06 04:47 AM
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)
Posted By: Cork Re: Get text line from mous in custum window - 02/05/06 03:14 PM
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
Posted By: Bob57 Re: Get text line from mous in custum window - 02/05/06 07:52 PM
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.
Posted By: DaveC Re: Get text line from mous in custum window - 02/05/06 08:25 PM
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.
Posted By: Cork Re: Get text line from mous in custum window - 03/05/06 04:17 AM
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
Posted By: DaveC Re: Get text line from mous in custum window - 03/05/06 06:58 PM
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.
© mIRC Discussion Forums