[GH-ISSUE #813] [QUESTION] Optionally limiting height of dropdown to height of form where dropdown is defined? #593

Closed
opened 2026-03-04 01:06:18 +03:00 by kerem · 2 comments
Owner

Originally created by @twilight-roadrunner on GitHub (Feb 14, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/813

Is it possible to limit the height of a TView dropdown list such that its height will not exceed the borders of a form in which the dropdown has been defined?

A very cursory examination of the "dropdown.go" module would seem to suggest the height of a dropdown list is governed only by the size of the TCell screen upon which the form is being displayed. For long dropdown lists, this results in the borders of the form being exceeded and, in the case where the form is being displayed in a GO Winman window that is smaller than the screen size, causes any dropdown list content that would exist outside of the window border to not be visible.

Is there some technique when using TView dropdowns that can be employed to avoid this?

Many thanks for your time.

Originally created by @twilight-roadrunner on GitHub (Feb 14, 2023). Original GitHub issue: https://github.com/rivo/tview/issues/813 Is it possible to limit the height of a TView dropdown list such that its height will not exceed the borders of a form in which the dropdown has been defined? A very cursory examination of the "dropdown.go" module would seem to suggest the height of a dropdown list is governed only by the size of the TCell screen upon which the form is being displayed. For long dropdown lists, this results in the borders of the form being exceeded and, in the case where the form is being displayed in a GO Winman window that is smaller than the screen size, causes any dropdown list content that would exist outside of the window border to not be visible. Is there some technique when using TView dropdowns that can be employed to avoid this? Many thanks for your time.
kerem closed this issue 2026-03-04 01:06:18 +03:00
Author
Owner

@rivo commented on GitHub (Mar 25, 2023):

A drop-down list is meant to be opened only temporarily, to select the value of the drop-down element. So, yes, it can exceed the borders of the form it is contained in. I don't (yet?) see a reason why it should be constrained to the form's box, especially considering that some forms can be quite small.

I don't know "GO Winman" so I don't know how it relates to tview. But generally, if a tview application is contained in some window that doesn't display all of its contents, then I think you have to accept that some of it will not be visible.

As a possible solution, though, if you know in advance how large the visible area will be, you can use your own tcell.Screen object and use SetScreen() to force the application to use it. This might come with other drawbacks but it may just be ok for you.

<!-- gh-comment-id:1483909114 --> @rivo commented on GitHub (Mar 25, 2023): A drop-down list is meant to be opened only temporarily, to select the value of the drop-down element. So, yes, it can exceed the borders of the form it is contained in. I don't (yet?) see a reason why it should be constrained to the form's box, especially considering that some forms can be quite small. I don't know "GO Winman" so I don't know how it relates to `tview`. But generally, if a `tview` application is contained in some window that doesn't display all of its contents, then I think you have to accept that some of it will not be visible. As a possible solution, though, if you know in advance how large the visible area will be, you can use your own `tcell.Screen` object and use [`SetScreen()`](https://pkg.go.dev/github.com/rivo/tview#Application.SetScreen) to force the application to use it. This might come with other drawbacks but it may just be ok for you.
Author
Owner

@rivo commented on GitHub (Aug 26, 2023):

Closing this as it looks solved to me.

<!-- gh-comment-id:1694358955 --> @rivo commented on GitHub (Aug 26, 2023): Closing this as it looks solved to me.
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#593
No description provided.