Request: lineatpos()

Features wanted...
Post Reply
highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Request: lineatpos()

Post 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
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Request: lineatpos()

Post by highend »

<bump>
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

admin
Site Admin
Posts: 60290
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Request: lineatpos()

Post by admin »

Coming as PosAtPos().

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Request: lineatpos()

Post 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...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

admin
Site Admin
Posts: 60290
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Request: lineatpos()

Post by admin »

Ah yes, it returns the fixed internal indices rather than the positions. Easy to fix...

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Request: lineatpos()

Post by highend »

Cool.

I'll happily (quick)start my scripts by double clicking on their line number :tup:
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

admin
Site Admin
Posts: 60290
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Request: lineatpos()

Post 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() ... :)

jupe
Posts: 2749
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Request: lineatpos()

Post 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.

admin
Site Admin
Posts: 60290
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Request: lineatpos()

Post by admin »

Sure, I'll add {Index}. :tup:

Post Reply