mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #885] Beginner Question Regarding Checkbox #644
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#644
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 @daryl-williams on GitHub (Sep 11, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/885
I'm not sure if this is the right place to ask a newbie question, if there is a better place please let me know. I have a form with a number of checkboxes and I want to be able to set them all to checked when a button is clicked. I have some code as follows:
I would like to be able to programmatically check each checkbox item. I have tried using item.SetChecked() but I am told:
item.SetChecked undefined (type tview.FormItem has no field or method SetChecked)When I print out the item type of
itemI get *tview.CheckBox and when I print the type of&itemI get *tview.FormItem and when I print the value (using %v) I get what appears to be a struct with 12 fields which is where I think the value I want to set resides.Any help clearing this up would be appreciated, I have searched online and perused the demo code trying to find examples of how to work with checkboxes without much luck.
Regards,
Daryl
@daryl-williams commented on GitHub (Sep 12, 2023):
@digitallyserviced
Thanks for your reply, I appreciate the explanation and the example code, it really helped me to understand the Go language better and helped me get that code working.
Regards
Daryl