[GH-ISSUE #1056] Export flexItem struct #765

Closed
opened 2026-03-04 01:07:34 +03:00 by kerem · 0 comments
Owner

Originally created by @ayn2op on GitHub (Nov 23, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1056

Currently, there is no way to get a flexItem instance from a Flex. You can retrieve the underlying primitive using the (*tview.Flex).GetItem method; however, if you want to dynamically modify the proportion or fixedSize of a flexItem, this is not possible. Furthermore, modifying the inner primitive (Item) is not possible either. I propose to export the flexItem struct and add a new method GetFlexItem.

// FlexItem holds layout options for one item.
type FlexItem struct {
	Item       Primitive // The item to be positioned. May be nil for an empty item.
	FixedSize  int       // The item's fixed size which may not be changed, 0 if it has no fixed size.
	Proportion int       // The item's proportion.
	Focus      bool      // Whether or not this item attracts the layout's focus.
}

func (*tview.Flex) GetFlexItem() *FlexItem
Originally created by @ayn2op on GitHub (Nov 23, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/1056 Currently, there is no way to get a `flexItem` instance from a `Flex`. You can retrieve the underlying primitive using the `(*tview.Flex).GetItem` method; however, if you want to dynamically modify the `proportion` or `fixedSize` of a `flexItem`, this is not possible. Furthermore, modifying the inner primitive (`Item`) is not possible either. I propose to export the `flexItem` struct and add a new method `GetFlexItem`. ```go // FlexItem holds layout options for one item. type FlexItem struct { Item Primitive // The item to be positioned. May be nil for an empty item. FixedSize int // The item's fixed size which may not be changed, 0 if it has no fixed size. Proportion int // The item's proportion. Focus bool // Whether or not this item attracts the layout's focus. } func (*tview.Flex) GetFlexItem() *FlexItem ```
kerem closed this issue 2026-03-04 01:07:34 +03:00
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#765
No description provided.