Page 1 of 1

Request: lineatpos()

Posted: 27 Jul 2021 16:54
by highend
Why?

To make full use of custom event actions, "clicking on line numbers".

I find it highly irritating that it doesn't matter where you click in the line numbers column (apart from the header)
and the cea is executed for the current selected item instead of the item at the line number I'm clicking on.

With this addition we can precisely define what will happen...

Code: Select all

lineatpos()

Returns the line number (only in a list pane) at a certain screen position.
Otherwise it'll return 0.

Syntax

lineatpos([x], [y], [flags])

x (optional) Defaults to the X mouse position on screen. 

y (optional) Defaults to the Y mouse position on screen. 

flags

 0: If x and y are passed, they are the position on screen. 

 1: If x and y are passed, they are the position on XYplorer. 

return Line number.

Examples
echo lineatpos(); //line number (in list pane) at current mouse position on screen

Re: Request: lineatpos()

Posted: 05 Sep 2021 21:34
by highend
<bump>

Re: Request: lineatpos()

Posted: 12 Sep 2021 11:32
by admin
Coming as PosAtPos().

Re: Request: lineatpos()

Posted: 12 Sep 2021 12:25
by highend
Thanks!

Did you try it when hovering over the catalog?

It seems to work fine on all other controls but it spits out weird values for catalog entries...

Re: Request: lineatpos()

Posted: 12 Sep 2021 12:30
by admin
Ah yes, it returns the fixed internal indices rather than the positions. Easy to fix...

Re: Request: lineatpos()

Posted: 12 Sep 2021 12:37
by highend
Cool.

I'll happily (quick)start my scripts by double clicking on their line number :tup:

Re: Request: lineatpos()

Posted: 12 Sep 2021 15:22
by admin
admin wrote: 12 Sep 2021 12:30 Ah yes, it returns the fixed internal indices rather than the positions. Easy to fix...
BTW, SC catalogexecute uses the index, not the position. So returning the index might be useful. Guess we also need indexatpos() ... :)

Re: Request: lineatpos()

Posted: 12 Sep 2021 16:04
by jupe
I am drifting off topic but do you think if you are going to implement that, it would be possible to add this too, assuming it's a convenient time?

viewtopic.php?p=163770#p163770

So that it can be used when the cursor isn't over the catalog.

Re: Request: lineatpos()

Posted: 12 Sep 2021 17:46
by admin
Sure, I'll add {Index}. :tup: