$sline » History » Version 2
Per Amundsen, 08/10/2015 08:13 AM
| 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 | @name - The window name. |
||
| 10 | N - If N = 0, returns the total number of selected lines in the window, otherwise the Nth line. |
||
| 11 | |||
| 12 | *Properties* |
||
| 13 | |||
| 14 | .ln - Returns the line number of Nth selected line. |
||
| 15 | |||
| 16 | *Example* |
||
| 17 | |||
| 18 | <pre> |
||
| 19 | ; Create a custom window with a listbox. |
||
| 20 | /window -l @example |
||
| 21 | |||
| 22 | ; Add some items to the listbox. |
||
| 23 | /aline @example Test1 |
||
| 24 | /aline @example Test2 |
||
| 25 | /aline @example Test2 |
||
| 26 | |||
| 27 | ; Select the second line in the listbox. |
||
| 28 | /sline @example 2 |
||
| 29 | |||
| 30 | ; Print the number og selected lines in the listbox. |
||
| 31 | //echo -ag $sline(@example, 0) |
||
| 32 | |||
| 33 | ; Print the value of the first selected line in the listbox. |
||
| 34 | //echo -ag $sline(@example, 1) |
||
| 35 | |||
| 36 | ; Print the line number of the first selected line in the listbox. |
||
| 37 | //echo -ag $sline(@example, 1).ln |
||
| 38 | </pre> |
||
| 39 | |||
| 40 |