[GH-ISSUE #371] "Optional keyboard shortcuts" - List #274

Closed
opened 2026-03-04 01:03:32 +03:00 by kerem · 3 comments
Owner

Originally created by @shilangyu on GitHub (Nov 27, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/371

The godoc in the introduction states:

...
- List: A navigable text list with optional keyboard shortcuts.
...

However i was not able to find any info on how to get rid of the shortcuts. Im trying to make a list without these shortcuts, how could i achieve that?

Originally created by @shilangyu on GitHub (Nov 27, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/371 The godoc in [the introduction](https://godoc.org/github.com/rivo/tview#hdr-Widgets) states: > ... > \- List: A navigable text list with optional keyboard shortcuts. > ... However i was not able to find any info on how to get rid of the shortcuts. Im trying to make a list without these shortcuts, how could i achieve that?
kerem closed this issue 2026-03-04 01:03:33 +03:00
Author
Owner

@rivo commented on GitHub (Nov 27, 2019):

For List objects, you define the shortcuts yourself when calling AddItem() or InsertItem(). See the documentation:

The shortcut is a key binding. If the specified rune is entered, the item is selected immediately. Set to 0 for no binding.

So if you provide 0, there will be no such shortcut.

However, the arrow keys etc. will still work. If you need to, you can also get rid of them. Please have a look at SetInputCapture(). It works for List, too.

Let me know if you have any further questions.

<!-- gh-comment-id:559124623 --> @rivo commented on GitHub (Nov 27, 2019): For `List` objects, you define the shortcuts yourself when calling `AddItem()` or `InsertItem()`. See the documentation: > The shortcut is a key binding. If the specified rune is entered, the item is selected immediately. Set to 0 for no binding. So if you provide `0`, there will be no such shortcut. However, the arrow keys etc. will still work. If you need to, you can also get rid of them. Please have a look at [`SetInputCapture()`](https://godoc.org/github.com/rivo/tview#Box.SetInputCapture). It works for `List`, too. Let me know if you have any further questions.
Author
Owner

@shilangyu commented on GitHub (Nov 27, 2019):

Completely missed the Set to 0 for no binding. part, thanks and sorry!

<!-- gh-comment-id:559277274 --> @shilangyu commented on GitHub (Nov 27, 2019): Completely missed the `Set to 0 for no binding.` part, thanks and sorry!
Author
Owner

@rivo commented on GitHub (Nov 28, 2019):

No problem. 😊

<!-- gh-comment-id:559375171 --> @rivo commented on GitHub (Nov 28, 2019): No problem. 😊
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#274
No description provided.