mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #765] Differentiate FormItems by type #559
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#559
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @drsag-aha on GitHub (Oct 27, 2022).
Original GitHub issue: https://github.com/rivo/tview/issues/765
Hi,
I have a form with dropdowns and inputfields and want automatically write a config file out of the inputs.
With
form.GetFormItem(1).(*tview.DropDown).GetCurrentOption()I get the current option of my dropdown.My Problem is to differntiate between the FormItems to get the content of them.
How can I manage to do something like in the pseudocode?
Pseudocode:
@drsag-aha commented on GitHub (Oct 28, 2022):
Found the solution by using the reflect package.
reflect.TypeOf(form.GetFormItem(i))@rivo commented on GitHub (Oct 28, 2022):
You can also use type switches. That's probably faster than using
reflect.