ConsoleGuiTools
ConsoleGuiTools copied to clipboard
OCGV: Request: Focus a specific row on opening the grid view
Consider:
$L = Get-TineWMSLocation -StagingLive
$P = Get-TineWMSLocation -StagingPilot
$T = Get-TineWMSLocation -StagingTrunk
$List = @($L, $P, $T)
$sel = $List | Select-Object BuildName, GlobalLocationId, LocationName | Out-ConsoleGridView -OutputMode Single -Title "Select Build for synchronisation"
Coming to this code, I have a target which has buildname 'Pilot', i.e. the second of the options. I would like to have that option preselected so that all the user has to do, is to press enter.
Suggestion - add an option to focus a row.
F.x. Out-ConsoleGridView -OutputMode Single -Focus 'Live'
-Focus could use the first column as "key"
This could also work for -OutputMode Multiple where it would focus the first list row where the first column matches the focus string.
Groovy idea.
So the -Focus parameter is a search string. A simple implementation would require it to match perfectly. An complex implementation would make it a regex or something.
@andschwa please prefix title with "OCGV: ".
I really like this suggestion. I suggest it get implemented when I move OCGV to use Terminal.Gui's built in Table class.
So the
-Focusparameter is a search string. A simple implementation would require it to match perfectly. An complex implementation would make it a regex or something.
Hi @andschwa, @LarsFosdal
I agree on the usefulness of incorporating a search function.
However, it seems to me that it would be better to have two independent parameters: Focus and Search
The Focus parameter would be used to set which interface element has the focus initially. Currently it would have two possible values: Filter, Grid.
The Search parameter would be responsible for positioning the cursor on the first element of the list that meets the search condition. Perhaps it would be convenient if the rows (or cells) that match the search were also highlighted in the grid.
Something to analyze is whether it would be convenient to add the Search field in the interface as it currently is Filter. In grids it is frequent that these two functionalities can be accessed independently of each other. If we decide affirmatively in this sense, Search should be added as another possible value of Focus.
Functionally, Filter hides the items that don't match in the grid, Search only highlights them and allows us to navigate from one to another. For the latter, the corresponding keyboard shortcuts should be added.
Kind regards, Claudio Salvio
I concur. Good suggestions!
I love this.