mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[PR #300] Added collection of FormItemArgs for each of the form FormItem types #904
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#904
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?
📋 Pull Request Information
Original PR: https://github.com/rivo/tview/pull/300
Author: @mikeschinkel
Created: 6/10/2019
Status: 🔄 Open
Base:
master← Head:formitemargs📝 Commits (1)
06a95afAdd feature-complete FormItemArgs for testing📊 Changes
6 files changed (+545 additions, -5 deletions)
View changed files
📝
checkbox.go(+93 -0)📝
dropdown.go(+103 -0)📝
form.go(+69 -5)➕
formitemargs.go(+48 -0)📝
inputfield.go(+125 -0)➕
passwordfield.go(+107 -0)📄 Description
After working with Forms for a while and requesting several PRs to make working with them easier I finally had enough with the complexity and decided to implement an alternate method to add form fields than
<form>.AddInputField(),<form>.AddPasswordField(),<form>.AddDropdown(), and<form>.AddCheckbox().The *biggest problem I was trying to fix were that once a field was added it was tedious to then access the form to set other properties not allow to be set in the
FormItemsNew...()method. So I tried numerous iterations with the absolute requirement of backward compatibility and came up with the following, by example:I would have preferred to use the names
AddInputField()etc. but could not do so w/o breaking old code so I extendedAddFormItem()instead.There is also a ton of effectively duplicated code, but given the structure of the existing code I could not find a way to consolidate code without breaking backward compatibility. If breaking backward compatibility is an option, I could change the code to be more maintainable, but I needed the functionality and I assumed you would be much less likely to access broken backward compatibility so I went ahead and implemented as is.
Hopefully you will concur this is a good addition to tview and accept this PR? Thanks in advance for considering.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.