mirror of
https://github.com/rivo/tview.git
synced 2026-04-29 06:45:56 +03:00
[GH-ISSUE #704] Make selected button text underlined #514
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#514
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 @riscie on GitHub (Mar 1, 2022).
Original GitHub issue: https://github.com/rivo/tview/issues/704
Hi there
Great library. We are building a small TUI for managing a local kubernetes cluster and our team really enjoys working with the library. Great work 👏
I wanted to ask, wether there is any way to make all buttons use an underlined text when they are in focus. I browsed the sourcecode a bit and to me it seems this is not yet possible at the moment. In modals for example, it seems it is not possible to get a hold of the buttons after adding them with
AddButtons(...). The styles.go is also not exporting something like this for the user to set it globally atm.Is there a way to achieve this?
Kindly, Riscie
@darkhz commented on GitHub (Mar 2, 2022):
Possibly you could do the following:
Create a custom modal/dialog box. For example you could draw a flex, and specifically add a textview and button primitives to it. For each of the buttons, attach a SetFocusFunc, and within the SetFocusFunc you could modify the button's label to include an underline.
Or, you could draw a Form primitive, add buttons to it, get each button using GetButton or GetButtonIndex, and attach a SetFocusFunc to the Button primitive returned by GetButton/GetButtonIndex.
This is a code example to illustrate the first point that was mentioned above.
@rivo commented on GitHub (Dec 17, 2022):
There is a
Button.SetActivatedStyle(style)function now which will allow you to underline the text for activated buttons. Note that if you're using a button as part of aForm, you should useForm.SetButtonActivatedStyle(style).@robgonnella commented on GitHub (Jun 20, 2023):
@rivo first off, thank you for your wonderful contribution with tview! I recently started building a terminal app and have really been enjoying how fun and easy it is to build with the help of this project.
With regard to the modal component, it would be great if we could add access to the
SetActivatedStylemethod of underlying form in your modal implementation. I'm happy to attempt a PR if you're open to the idea.@rivo commented on GitHub (Jun 21, 2023):
@robgonnella Done with the latest commit.
@robgonnella commented on GitHub (Jun 23, 2023):
Thanks @rivo !