$sline » History » Version 3
Per Amundsen, 02/23/2023 07:39 PM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | 2 | Per Amundsen | *$sline(@name,N)* |
| 4 | 1 | Per Amundsen | |
| 5 | Returns the Nth selected line in a listbox. |
||
| 6 | |||
| 7 | *Parameters* |
||
| 8 | |||
| 9 | 3 | Per Amundsen | table(ktable). |
| 10 | |*Parameter*|*Description*| |
||
| 11 | | @name | The window name. | |
||
| 12 | | N | If N = 0, returns the total number of selected lines in the window, otherwise the Nth line. | |
||
| 13 | 1 | Per Amundsen | |
| 14 | *Properties* |
||
| 15 | |||
| 16 | 3 | Per Amundsen | table(ktable). |
| 17 | |*Property*|*Description*| |
||
| 18 | | .ln | Returns the line number of Nth selected line. | |
||
| 19 | 1 | Per Amundsen | |
| 20 | *Example* |
||
| 21 | |||
| 22 | <pre> |
||
| 23 | ; Create a custom window with a listbox. |
||
| 24 | /window -l @example |
||
| 25 | |||
| 26 | ; Add some items to the listbox. |
||
| 27 | /aline @example Test1 |
||
| 28 | /aline @example Test2 |
||
| 29 | /aline @example Test2 |
||
| 30 | |||
| 31 | ; Select the second line in the listbox. |
||
| 32 | /sline @example 2 |
||
| 33 | |||
| 34 | ; Print the number og selected lines in the listbox. |
||
| 35 | //echo -ag $sline(@example, 0) |
||
| 36 | |||
| 37 | ; Print the value of the first selected line in the listbox. |
||
| 38 | //echo -ag $sline(@example, 1) |
||
| 39 | |||
| 40 | ; Print the line number of the first selected line in the listbox. |
||
| 41 | //echo -ag $sline(@example, 1).ln |
||
| 42 | </pre> |
||
| 43 | |||
| 44 |